From cad600d12ca89b3f2632c7d3263ab597d97c5149 Mon Sep 17 00:00:00 2001
From: Harald Welte <laforge@gnumonks.org>
Date: Sat, 13 Nov 2010 17:25:43 +0100
Subject: On the Olimex board, the buttons are low-active

Thus, we need to invert our check during the dfu / main dual boot
decision
---
 firmware/src/start/Cstartup.S | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

(limited to 'firmware')

diff --git a/firmware/src/start/Cstartup.S b/firmware/src/start/Cstartup.S
index 83e7696..a28b400 100644
--- a/firmware/src/start/Cstartup.S
+++ b/firmware/src/start/Cstartup.S
@@ -95,9 +95,11 @@
 #elif defined(PICC)
 	.equ PIO_BOOTLDR,     (1 << 6)
 #elif defined(OLIMEX)
+	/* Olimex SAM7-Pxxx boards have a button B1 on PA19 that is low-active */
 	.equ PIO_BOOTLDR,     (1 << 19)
+#define CONFIG_DFU_SWITCH_INV
 #else
-#error please define PIO_BOOTLDR
+#error please define PIO_BOOTLDR for your board
 #endif
 
 
@@ -373,7 +375,11 @@ LoopZI:         CMP     R1, R2
 		ldr 	r1, =AT91C_BASE_PIOA
 		ldr	r2, [r1, #PIOA_PDSR]
 		tst	r2, #PIO_BOOTLDR
+#ifdef CONFIG_DFU_SWITCH_INV
+		beq	_reloc_dfu
+#else
 		bne	_reloc_dfu
+#endif /* SWITCH_INV */
 #endif
 
 		bx	r10
-- 
cgit v1.2.3