Skip to contentSkip to conversation

ARM LED weak symbols

U-Boot In review Tom Rix 6 participants 21 messages Nov 4, 2009 – Nov 15, 2009

lore
Share & tools
lore

Tom Rix

author
#0 lore raw

As discussed earlier today

http://lists.denx.de/pipermail/u-boot/2009-November/063711.html

This is the patch to conditionally compile the ARM board LED functions.

It was regression tested with MAKEALL arm using the Code Sourcery 2009 compiler and my roll-your-own gcc-4.4.2

Both patches were runtested with the Code Sourcery compiler on Zoom2.

Since this is a common patch, I would like to see it tested on other boards (hint).

I will wait till tomorrow for comments and then push it to arm/next.

Tom

author
#1 lore raw

PATCH 1/2 ARM Conditionally compile board LED functions

The ARM board LED functions are defined as weak.
They add a size overhead if they are not used.

Now they are only defined if CONFIG_STATUS_LED is also defined.

The arm920t and arm926ejs _start function calls these LED functions

bl coloured_LED_init
bl red_LED_on

In general, what happens is they call into the weak stubs. Only if the cpu/board provides an overriding function do these calls cause anything meaningful to happen.

Now this noop case is removed and these LED functions are excuted only when CONFIG_STATUS_LED is defined

---
 cpu/arm920t/start.S   |    4 ++--
 cpu/arm926ejs/start.S |    4 ++--
 lib_arm/board.c       |    2 ++
 3 files changed, 6 insertions(+), 4 deletions(-)
cpu/arm920t/start.S +2 -2
index 114427a..e05ebf3 100644
@@ -113,10 +113,10 @@ start_code:
 	bic	r0, r0, #0x1f
 	orr	r0, r0, #0xd3
 	msr	cpsr, r0
-
+#ifdef CONFIG_STATUS_LED
 	bl	coloured_LED_init
 	bl	red_LED_on
-
+#endif
 #if	defined(CONFIG_AT91RM9200DK) || defined(CONFIG_AT91RM9200EK)
 	/*
 	 * relocate exception table
cpu/arm926ejs/start.S +2 -2
index 4421b6a..117ffb1 100644
@@ -183,10 +183,10 @@ clbss_l:str	r2, [r0]		/* clear loop...                    */
 	add	r0, r0, #4
 	cmp	r0, r1
 	ble	clbss_l
-
+#ifdef CONFIG_STATUS_LED
 	bl coloured_LED_init
 	bl red_LED_on
-
+#endif
 	ldr	pc, _start_armboot
 
 _start_armboot:
lib_arm/board.c +2 -0
index 5e3d7f6..28b15da 100644
@@ -87,6 +87,7 @@ extern void rtl8019_get_enetaddr (uchar * addr);
 #endif
 
 
+#ifdef CONFIG_STATUS_LED
 /************************************************************************
  * Coloured LED functionality
  ************************************************************************
@@ -110,6 +111,7 @@ void inline __blue_LED_on(void) {}
 void inline blue_LED_on(void)__attribute__((weak, alias("__blue_LED_on")));
 void inline __blue_LED_off(void) {}
 void inline blue_LED_off(void)__attribute__((weak, alias("__blue_LED_off")));
+#endif
 
 /************************************************************************
  * Init Utilities							*
Signature · 1 line
1.6.0.6
author
#2 lore raw

PATCH 2/2 ARM: fix build error with gcc-4.4.2 about inline function declared weak

From: Abdoulaye Walsimou Gaye <[email protected]>

This patch fix build error with gcc-4.4.2 about inline function declared weak, see below:
board.c:96: error: inline function 'coloured_LED_init' cannot be declared weak board.c:98: error: inline function 'red_LED_on' cannot be declared weak board.c:100: error: inline function 'red_LED_off' cannot be declared weak board.c:102: error: inline function 'green_LED_on' cannot be declared weak board.c:104: error: inline function 'green_LED_off' cannot be declared weak board.c:106: error: inline function 'yellow_LED_on' cannot be declared weak board.c:108: error: inline function 'yellow_LED_off' cannot be declared weak board.c:110: error: inline function 'blue_LED_on' cannot be declared weak board.c:112: error: inline function 'blue_LED_off' cannot be declared weak make[1]: *** [board.o] Error 1

---
 lib_arm/board.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)
lib_arm/board.c +9 -9
index 28b15da..2665093 100644
@@ -94,23 +94,23 @@ extern void rtl8019_get_enetaddr (uchar * addr);
  * May be supplied by boards if desired
  */
 void inline __coloured_LED_init (void) {}
-void inline coloured_LED_init (void) __attribute__((weak, alias("__coloured_LED_init")));
+void coloured_LED_init(void)__attribute__((weak, alias("__coloured_LED_init")));
 void inline __red_LED_on (void) {}
-void inline red_LED_on (void) __attribute__((weak, alias("__red_LED_on")));
+void red_LED_on(void) __attribute__((weak, alias("__red_LED_on")));
 void inline __red_LED_off(void) {}
-void inline red_LED_off(void)	     __attribute__((weak, alias("__red_LED_off")));
+void red_LED_off(void)__attribute__((weak, alias("__red_LED_off")));
 void inline __green_LED_on(void) {}
-void inline green_LED_on(void) __attribute__((weak, alias("__green_LED_on")));
+void green_LED_on(void) __attribute__((weak, alias("__green_LED_on")));
 void inline __green_LED_off(void) {}
-void inline green_LED_off(void)__attribute__((weak, alias("__green_LED_off")));
+void green_LED_off(void)__attribute__((weak, alias("__green_LED_off")));
 void inline __yellow_LED_on(void) {}
-void inline yellow_LED_on(void)__attribute__((weak, alias("__yellow_LED_on")));
+void yellow_LED_on(void)__attribute__((weak, alias("__yellow_LED_on")));
 void inline __yellow_LED_off(void) {}
-void inline yellow_LED_off(void)__attribute__((weak, alias("__yellow_LED_off")));
+void yellow_LED_off(void)__attribute__((weak, alias("__yellow_LED_off")));
 void inline __blue_LED_on(void) {}
-void inline blue_LED_on(void)__attribute__((weak, alias("__blue_LED_on")));
+void blue_LED_on(void)__attribute__((weak, alias("__blue_LED_on")));
 void inline __blue_LED_off(void) {}
-void inline blue_LED_off(void)__attribute__((weak, alias("__blue_LED_off")));
+void blue_LED_off(void)__attribute__((weak, alias("__blue_LED_off")));
 #endif
 
 /************************************************************************
Signature · 1 line
1.6.0.6
#3 lore raw

[U-Boot] multiple partitions in mtdparts

Hi,

I am trying to define multiple partitions using mtdparts variable. But I can't get it set automatically right.

I defined the set_bootargs as the following:
set_bootargs=setenv bootargs root=/dev/mtdblock2 rootfs=cramfs,jffs2 mtdparts=ph ysmap-flash.0:256k(u-boot),256k(u-boot-env),7936k(root1),7936k(root2);physmap-fl ash.1:16384k(data) console=ttyS0,115200n8

But when I run set_bootargs, I got the following error -

# run set_bootargs
Unknown command 'physmap-flash.1:16384k(data)' - try 'help'
Can someone help me with the correct format on mtdparts? thanks a lot.

====================================================
mtdparts=mtdparts=physmap-flash.0:256k(u-boot),256k(u-boot-env),7936k(root1),793 6k(root2);physmap-flash.1:16384k(data)
boot=run set_bootargs;chpart nor0,${boot_device};fsload boot/uImage;bootm
mtdids=nor0=physmap-flash.0,nor1=physmap-flash.1
partition=nor0,2
mtddevnum=2
mtddevname=root1
set_bootargs=setenv bootargs root=/dev/mtdblock2 rootfs=cramfs,jffs2 mtdparts=ph ysmap-flash.0:256k(u-boot),256k(u-boot-env),7936k(root1),7936k(root2);physmap-fl ash.1:16384k(data) console=ttyS0,115200n8 bootargs=root=/dev/mtdblock2 rootfs=cramfs,jffs2 mtdparts=physmap-flash.0:256k(u -boot),256k(u-boot-env),7936k(root1),7936k(root2)

Environment size: 847/262140 bytes

# run set_bootargs
Unknown command 'physmap-flash.1:16384k(data)' - try 'help'
#
#4 lore raw

[U-Boot] multiple partitions in mtdparts

Am Mittwoch 04 November 2009 01:34:53 schrieb myuboot at fastmail.fm:

Quoted 11 lines

Hi,

I am trying to define multiple partitions using mtdparts variable. But I can't get it set automatically right.

I defined the set_bootargs as the following:
set_bootargs=setenv bootargs root=/dev/mtdblock2 rootfs=cramfs,jffs2 mtdparts=ph ysmap-flash.0:256k(u-boot),256k(u-boot-env),7936k(root1),7936k(root2);physmap-fl ash.1:16384k(data) console=ttyS0,115200n8

Quoted 5 lines

But when I run set_bootargs, I got the following error -

# run set_bootargs
Unknown command 'physmap-flash.1:16384k(data)' - try 'help'
Can someone help me with the correct format on mtdparts? thanks a lot.

I don't know the exact format but it looks like the ";" between (root2);physmap-flash1 causes your error?

Dieter

Quoted 27 lines

====================================================
mtdparts=mtdparts=physmap-flash.0:256k(u-boot),256k(u-boot-env),7936k(root1),793 6k(root2);physmap-flash.1:16384k(data)
boot=run set_bootargs;chpart nor0,${boot_device};fsload boot/uImage;bootm
mtdids=nor0=physmap-flash.0,nor1=physmap-flash.1
partition=nor0,2
mtddevnum=2
mtddevname=root1
set_bootargs=setenv bootargs root=/dev/mtdblock2 rootfs=cramfs,jffs2 mtdparts=ph ysmap-flash.0:256k(u-boot),256k(u-boot-env),7936k(root1),7936k(root2);physmap-fl ash.1:16384k(data) console=ttyS0,115200n8 bootargs=root=/dev/mtdblock2 rootfs=cramfs,jffs2 mtdparts=physmap-flash.0:256k(u -boot),256k(u-boot-env),7936k(root1),7936k(root2)

Environment size: 847/262140 bytes

# run set_bootargs
Unknown command 'physmap-flash.1:16384k(data)' - try 'help'
#
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
#5 lore raw

[U-Boot] multiple partitions in mtdparts

I thought that is a legal definition according to u-boot document section "5.9.3.5. mtdparts - define a Linux compatible MTD partition scheme" at http://www.denx.de/wiki/view/DULG/UBootCmdGroupFlash

mtdparts=mtdparts=<mtd-def>[;<mtd-def>...]

Thanks.

Quoted 52 lines · Dieter Kiermaier

Am Mittwoch 04 November 2009 01:34:53 schrieb myuboot at fastmail.fm:

Quoted 11 lines

Hi,

I am trying to define multiple partitions using mtdparts variable. But I can't get it set automatically right.

I defined the set_bootargs as the following:
set_bootargs=setenv bootargs root=/dev/mtdblock2 rootfs=cramfs,jffs2 mtdparts=ph ysmap-flash.0:256k(u-boot),256k(u-boot-env),7936k(root1),7936k(root2);physmap-fl ash.1:16384k(data) console=ttyS0,115200n8

Quoted 5 lines

But when I run set_bootargs, I got the following error -

# run set_bootargs
Unknown command 'physmap-flash.1:16384k(data)' - try 'help'
Can someone help me with the correct format on mtdparts? thanks a lot.

I don't know the exact format but it looks like the ";" between (root2);physmap-flash1 causes your error?

Dieter

Quoted 27 lines

====================================================
mtdparts=mtdparts=physmap-flash.0:256k(u-boot),256k(u-boot-env),7936k(root1),793 6k(root2);physmap-flash.1:16384k(data)
boot=run set_bootargs;chpart nor0,${boot_device};fsload boot/uImage;bootm
mtdids=nor0=physmap-flash.0,nor1=physmap-flash.1
partition=nor0,2
mtddevnum=2
mtddevname=root1
set_bootargs=setenv bootargs root=/dev/mtdblock2 rootfs=cramfs,jffs2 mtdparts=ph ysmap-flash.0:256k(u-boot),256k(u-boot-env),7936k(root1),7936k(root2);physmap-fl ash.1:16384k(data) console=ttyS0,115200n8 bootargs=root=/dev/mtdblock2 rootfs=cramfs,jffs2 mtdparts=physmap-flash.0:256k(u -boot),256k(u-boot-env),7936k(root1),7936k(root2)

Environment size: 847/262140 bytes

# run set_bootargs
Unknown command 'physmap-flash.1:16384k(data)' - try 'help'
#
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
#6 lore raw

[U-Boot] multiple partitions in mtdparts

Dear myuboot at fastmail.fm,

how about providing a realname?

And please read http://www.netmeister.org/news/learn2quote.html

Do not top post / full quote!

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

I thought that is a legal definition according to u-boot document section "5.9.3.5. mtdparts - define a Linux compatible MTD partition scheme" at http://www.denx.de/wiki/view/DULG/UBootCmdGroupFlash

mtdparts=mtdparts=<mtd-def>[;<mtd-def>...]

Yes, it is. But the shell is interpreting the semicolon so you have to escape it.

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
All men should freely use those seven words which have the  power  to
make any marriage run smoothly: You know dear, you may be right.
#7 lore raw

PATCH 2/2 ARM: fix build error with gcc-4.4.2 about inline function declared weak

In reply to Tom Rix

Dear Tom Rix,

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

From: Abdoulaye Walsimou Gaye <[email protected]>

This patch fix build error with gcc-4.4.2 about inline function declared weak, see below:
board.c:96: error: inline function 'coloured_LED_init' cannot be declared weak board.c:98: error: inline function 'red_LED_on' cannot be declared weak board.c:100: error: inline function 'red_LED_off' cannot be declared weak board.c:102: error: inline function 'green_LED_on' cannot be declared weak board.c:104: error: inline function 'green_LED_off' cannot be declared weak board.c:106: error: inline function 'yellow_LED_on' cannot be declared weak board.c:108: error: inline function 'yellow_LED_off' cannot be declared weak board.c:110: error: inline function 'blue_LED_on' cannot be declared weak board.c:112: error: inline function 'blue_LED_off' cannot be declared weak make[1]: *** [board.o] Error 1

Quoted 1 line

What is this? Are you sure this patch is properly attributed? Was Abdoulaye Walsimou Gaye really the first to submit this patch?

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
Quote from a recent meeting:   "We are going to continue having these
meetings everyday until I find out why no work is getting done."
author
#8 lore raw

PATCH 2/2 ARM: fix build error with gcc-4.4.2 about inline function declared weak

Quoted 18 lines · Wolfgang Denk

Dear Tom Rix,

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

From: Abdoulaye Walsimou Gaye <[email protected]>

This patch fix build error with gcc-4.4.2 about inline function declared weak, see below:
board.c:96: error: inline function 'coloured_LED_init' cannot be declared weak board.c:98: error: inline function 'red_LED_on' cannot be declared weak board.c:100: error: inline function 'red_LED_off' cannot be declared weak board.c:102: error: inline function 'green_LED_on' cannot be declared weak board.c:104: error: inline function 'green_LED_off' cannot be declared weak board.c:106: error: inline function 'yellow_LED_on' cannot be declared weak board.c:108: error: inline function 'yellow_LED_off' cannot be declared weak board.c:110: error: inline function 'blue_LED_on' cannot be declared weak board.c:112: error: inline function 'blue_LED_off' cannot be declared weak make[1]: *** [board.o] Error 1

Quoted 9 lines
Quoted 1 line

What is this? Are you sure this patch is properly attributed? Was Abdoulaye Walsimou Gaye really the first to submit this patch?

Best regards,

Wolfgang Denk

Would you like the older one ?
As you said, they looked the same.

Tom

#9 lore raw

PATCH 2/2 ARM: fix build error with gcc-4.4.2 about inline function declared weak

Dear Tom,

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

What is this? Are you sure this patch is properly attributed? Was Abdoulaye Walsimou Gaye really the first to submit this patch?

Quoted 6 lines
Quoted 4 lines

Best regards,

Wolfgang Denk

Would you like the older one ?
As you said, they looked the same.

It does not matter what I like. What matters is who is to be credited for this patch, and in my opinion this has to be the first to submit it.

You don't get any credits any more today for inventing a light bulb, either.

Best regards,

Wolfgang Denk

Signature · 4 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
Stupidity, like virtue, is its own reward.
author
#10 lore raw

PATCH 2/2 ARM: fix build error with gcc-4.4.2 about inline function declared weak

Quoted 18 lines · Wolfgang Denk

Dear Tom,

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

What is this? Are you sure this patch is properly attributed? Was Abdoulaye Walsimou Gaye really the first to submit this patch?

Best regards,

Wolfgang Denk

Would you like the older one ?
As you said, they looked the same.

It does not matter what I like. What matters is who is to be credited for this patch, and in my opinion this has to be the first to submit it.

Quoted 7 lines

You don't get any credits any more today for inventing a light bulb, either.

Best regards,

Wolfgang Denk

I have pushed the earlier patch to arm/next.
Tom

Author: Ron Lee <[email protected]>
Date:   Wed Aug 5 20:14:01 2009 +0200

ARM Don't inline weak symbols

------------------------------------------------------------------------

GCC 4.4 complains about this now.

#11 lore raw

PATCH 2/2 ARM: fix build error with gcc-4.4.2 about inline function declared weak

Dear Tom,

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

I have pushed the earlier patch to arm/next.

Thnaks, but this being a clear bug fix I think we should include this in the upcoming release?

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 wish I had a bronze torc for every user who didn't read the manual.
                             - Terry Pratchett, _The Light Fantastic_
author
#12 lore raw

[U-Boot] ARM pull request

Wolfgang,

I have cherry picked the weak sym change into arm/master-sync This is the pull request.
Tom

The following changes since commit 0f365273a6c210e0d82f6dca3994be5283e6bf82:
Wolfgang Denk (1):
Merge branch 'master-sync' of git://git.denx.de/u-boot-arm

are available in the git repository at:

git://git.denx.de/u-boot-arm master-sync

Ron Lee (1):
ARM Don't inline weak symbols

  lib_arm/board.c |   18 +++++++++---------
  1 files changed, 9 insertions(+), 9 deletions(-)
#13 lore raw

[U-Boot] ARM pull request

Dear Tom,

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

I have cherry picked the weak sym change into arm/master-sync This is the pull request.
Tom

The following changes since commit 0f365273a6c210e0d82f6dca3994be5283e6bf82:
Wolfgang Denk (1):
Merge branch 'master-sync' of git://git.denx.de/u-boot-arm

are available in the git repository at:

Quoted 7 lines

git://git.denx.de/u-boot-arm master-sync

Ron Lee (1):
ARM Don't inline weak symbols

  lib_arm/board.c |   18 +++++++++---------
  1 files changed, 9 insertions(+), 9 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 8 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
In the beginning, I was made. I didn't ask to be made. No one consul-
ted with me or considered my feelings  in  this  matter.  But  if  it
brought  some  passing fancy to some lowly humans as they haphazardly
pranced their way through life's mournful jungle, then so be it.
- Marvin the Paranoid Android
#14 lore raw

PATCH 2/2 ARM: fix build error with gcc-4.4.2 about inline function declared weak

In reply to Wolfgang Denk
Quoted 22 lines · Wolfgang Denk

Dear Tom,

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

What is this? Are you sure this patch is properly attributed? Was Abdoulaye Walsimou Gaye really the first to submit this patch?

Quoted 8 lines
Quoted 5 lines

Best regards,

Wolfgang Denk

Would you like the older one ?
As you said, they looked the same.

It does not matter what I like. What matters is who is to be credited for this patch, and in my opinion this has to be the first to submit it.

Quoted 8 lines

You don't get any credits any more today for inventing a light bulb, either.

Best regards,

Wolfgang Denk

Hello all,
May be having tools such as patchwork will avoid people to submit the same patch.
Recently linux-mips[1] adopted patchwork and it seems useful (for submitters and maintainers).

Best regards,

[1] http://www.linux-mips.org/archives/linux-mips/2009-11/msg00273.html

#15 lore raw

PATCH 1/2 ARM Conditionally compile board LED functions

In reply to Tom Rix

Dear Tom Rix,

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

The ARM board LED functions are defined as weak.
They add a size overhead if they are not used.

Now they are only defined if CONFIG_STATUS_LED is also defined.

The arm920t and arm926ejs _start function calls these LED functions

bl coloured_LED_init
bl red_LED_on

Quoted 7 lines

In general, what happens is they call into the weak stubs. Only if the cpu/board provides an overriding function do these calls cause anything meaningful to happen.

Now this noop case is removed and these LED functions are excuted only when CONFIG_STATUS_LED is defined

I don't get it. We use "weak" to avoid #ifdef's, and you insert new
#ifdef's? That seems to be the wrong approach 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
"What if" is a trademark of Hewlett Packard, so stop using it in your
sentences without permission, or risk being sued.
author
#16 lore raw

PATCH 1/2 ARM Conditionally compile board LED functions

Quoted 18 lines · Wolfgang Denk

Dear Tom Rix,

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

The ARM board LED functions are defined as weak.
They add a size overhead if they are not used.

Now they are only defined if CONFIG_STATUS_LED is also defined.

The arm920t and arm926ejs _start function calls these LED functions

bl coloured_LED_init
bl red_LED_on

In general, what happens is they call into the weak stubs. Only if the cpu/board provides an overriding function do these calls cause anything meaningful to happen.

Quoted 6 lines
Quoted 2 lines

Now this noop case is removed and these LED functions are excuted only when CONFIG_STATUS_LED is defined

I don't get it. We use "weak" to avoid #ifdef's, and you insert new
#ifdef's? That seems to be the wrong approach to me.

The arguments for using weak are getting weak :P

Using weak is less relevant with the #ifdef's
The benefit now is that boards that use the led functions do not have to define all of them.

I am open to ideas on how to kill weak off completely.

Has a general led driver layer ever been proposed ? Something to convert status led for a mixture of #defines and weak symbols to something that had a register function and some file_ops ?

Tom

Tom

Quoted 4 lines

Best regards,

Wolfgang Denk

#17 lore raw

PATCH 1/2 ARM Conditionally compile board LED functions

Dear Tom,

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

The arguments for using weak are getting weak :P

:-P

Quoted 1 line

Using weak is less relevant with the #ifdef's

But it's the wrong direction your heading. We should get rid of #ifdef's, not add new ones.

With #ifdef's, you have different versions of the code, which increases the multitude of configurations that actually need to be tested. With weak, you have one version of the code only.

Quoted 2 lines

The benefit now is that boards that use the led functions do not have to define all of them.

That's just an indication of a broken implementation.

Normally you would provide the weak functions in a central place, where any board configuration which wants can overwrite them, or not.

Quoted 1 line

I am open to ideas on how to kill weak off completely.

You got it wrong.

We want to kill off the #ifdef's.

Quoted 4 lines

Has a general led driver layer ever been proposed ? Something to convert status led for a mixture of #defines and weak symbols to something that had a register function and some file_ops ?

We use status LEDs on many boards, without real issues. It's only AT91 which suffers from this mess.

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
"There is nothing new under the sun, but there are lots of old things
we don't know yet."                                  - Ambrose Bierce
author
#18 lore raw

PATCH 1/2 ARM Conditionally compile board LED functions

Quoted 7 lines · Wolfgang Denk

Dear Tom,

Quoted 1 line · In message <[email protected]> you wrote:

The arguments for using weak are getting weak :P

:-P

Quoted 9 lines
Quoted 1 line

Using weak is less relevant with the #ifdef's

But it's the wrong direction your heading. We should get rid of #ifdef's, not add new ones.

With #ifdef's, you have different versions of the code, which increases the multitude of configurations that actually need to be tested. With weak, you have one version of the code only.

To use the status led api, you have to define CONFIG_STATUS_LED anyway. I did not think this added to the configuration space.

Quoted 5 lines
Quoted 2 lines

The benefit now is that boards that use the led functions do not have to define all of them.

That's just an indication of a broken implementation.

Quoted 9 lines

Normally you would provide the weak functions in a central place, where any board configuration which wants can overwrite them, or not.

Quoted 1 line

I am open to ideas on how to kill weak off completely.

You got it wrong.

We want to kill off the #ifdef's.

My vector is obviously pointing in the wrong direction..

Quoted 8 lines
Quoted 4 lines

Has a general led driver layer ever been proposed ? Something to convert status led for a mixture of #defines and weak symbols to something that had a register function and some file_ops ?

We use status LEDs on many boards, without real issues. It's only AT91 which suffers from this mess.

I withdraw this patch.
I will rethink this and come up with something better.

Tom

Quoted 4 lines

Best regards,

Wolfgang Denk

#19 lore raw

PATCH 1/2 ARM Conditionally compile board LED functions

Quoted 2 lines

I withdraw this patch.
I will rethink this and come up with something better.

I agree weak is better than ifdef. But the led situation on ARM isn't really pleasant when you look in lib_arm/board.c .

When I proposed a simplification of board.c back on Jul 22 ("[RFC] arm/board.c: avoid ifdef using weak default functions", I noticed the led approach and thought it would need cleanup (for example, by moving out of board.c to led.c or something). However, the patch was rejected by JC as he has initcalls as work in progress.

Since we still missing the initcalls (as missing JC), could that patch be reconsidered? I can rebase if there's any interest.

/alessandro

author
#20 lore raw

PATCH 1/2 ARM Conditionally compile board LED functions

Quoted 6 lines · Alessandro Rubini
Quoted 2 lines

I withdraw this patch.
I will rethink this and come up with something better.

I agree weak is better than ifdef. But the led situation on ARM isn't really pleasant when you look in lib_arm/board.c .

Quoted 9 lines

When I proposed a simplification of board.c back on Jul 22 ("[RFC] arm/board.c: avoid ifdef using weak default functions", I noticed the led approach and thought it would need cleanup (for example, by moving out of board.c to led.c or something). However, the patch was rejected by JC as he has initcalls as work in progress.

Since we still missing the initcalls (as missing JC), could that patch be reconsidered? I can rebase if there's any interest.

Yes I am interested.
Please rebase the RFC patch.

Here is the link to the old RFC
http://lists.denx.de/pipermail/u-boot/2009-July/057273.html

Thanks,
Tom

Quoted 1 line

/alessandro