[U-Boot] [PATCH 1/2] ARM Conditionally compile board LED functions

Tom Rix Tom.Rix at windriver.com
Wed Nov 4 01:00:03 CET 2009


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

Signed-off-by: Tom Rix <Tom.Rix at windriver.com>
---
 cpu/arm920t/start.S   |    4 ++--
 cpu/arm926ejs/start.S |    4 ++--
 lib_arm/board.c       |    2 ++
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/cpu/arm920t/start.S b/cpu/arm920t/start.S
index 114427a..e05ebf3 100644
--- a/cpu/arm920t/start.S
+++ b/cpu/arm920t/start.S
@@ -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
diff --git a/cpu/arm926ejs/start.S b/cpu/arm926ejs/start.S
index 4421b6a..117ffb1 100644
--- a/cpu/arm926ejs/start.S
+++ b/cpu/arm926ejs/start.S
@@ -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:
diff --git a/lib_arm/board.c b/lib_arm/board.c
index 5e3d7f6..28b15da 100644
--- a/lib_arm/board.c
+++ b/lib_arm/board.c
@@ -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							*
-- 
1.6.0.6



More information about the U-Boot mailing list