[U-Boot] [PATCH] ARM - Integrator[AP/CP] - - Correct Improper ulong division

Gururaja Hebbar K R gururajakr at sanyo.co.in
Thu Aug 28 14:02:29 CEST 2008


Hi,

- Correct Improper ulong division. This patch take care of
   multiple definition of `__udivsi3' & undefined reference to `raise' Error
   when compiling [ap/cp]926ejs_config with CodeSourcery arm toolchain


Signed-off-by: Gururaja Hebbar <gururajakr at sanyo.co.in>
---
 board/integratorap/integratorap.c |    7 +++++--
 board/integratorcp/integratorcp.c |    7 +++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/board/integratorap/integratorap.c b/board/integratorap/integratorap.c
index e659907..421cdbb 100755
--- a/board/integratorap/integratorap.c
+++ b/board/integratorap/integratorap.c
@@ -611,6 +611,7 @@ void reset_timer_masked (void)
 ulong get_timer_masked (void)
 {
 	ulong now = READ_TIMER;		/* current count */
+	unsigned long long n;
 
 	if (now > lastdec) {
 		/* Must have wrapped */
@@ -618,8 +619,10 @@ ulong get_timer_masked (void)
 	} else {
 		total_count += lastdec - now;
 	}
-	lastdec	  = now;
-	timestamp = total_count/div_timer;
+	lastdec = now;
+	n = total_count;
+	do_div(n, div_timer);
+	timestamp = (ulong)n;
 
 	return timestamp;
 }
diff --git a/board/integratorcp/integratorcp.c b/board/integratorcp/integratorcp.c
index d6d6e13..8d85238 100755
--- a/board/integratorcp/integratorcp.c
+++ b/board/integratorcp/integratorcp.c
@@ -236,6 +236,7 @@ ulong get_timer_masked (void)
 {
 	/* get current count */
 	unsigned long long now = (unsigned long long)READ_TIMER;
+	unsigned long long n;
 
 	if(now > lastdec) {
 		/* Must have wrapped */
@@ -243,8 +244,10 @@ ulong get_timer_masked (void)
 	} else {
 		total_count += lastdec - now;
 	}
-	lastdec	  = now;
-	timestamp = (ulong)(total_count/div_timer);
+	lastdec = now;
+	n = total_count;
+	do_div(n, div_timer);
+	timestamp = (ulong)n;
 
 	return timestamp;
 }
-- 
1.5.6.4


More information about the U-Boot mailing list