From ad18651cdc0da907b0343651c73aa4b5e8f6af43 Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@6dc7ffe9-61d6-0310-9af1-9938baff3ed1> Date: Tue, 12 Sep 2006 16:54:59 +0000 Subject: - fix bootloader switch detection git-svn-id: https://svn.openpcd.org:2342/trunk@182 6dc7ffe9-61d6-0310-9af1-9938baff3ed1 --- openpcd/firmware/src/start/Cstartup.S | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'openpcd/firmware/src/start/Cstartup.S') diff --git a/openpcd/firmware/src/start/Cstartup.S b/openpcd/firmware/src/start/Cstartup.S index 1c9f1db..e91fd86 100644 --- a/openpcd/firmware/src/start/Cstartup.S +++ b/openpcd/firmware/src/start/Cstartup.S @@ -16,6 +16,8 @@ //*- 1.1 01/Apr/05 JPP : save SPSR //*-----------------------------------------------------------------------------*/ +#define CONFIG_DFU_SWITCH + //#define DEBUG_LL #ifdef DEBUG_LL @@ -59,6 +61,13 @@ .equ AIC_EOICR, (304) .equ AIC_MCR_RCR, (0xf00) .equ AT91C_BASE_AIC, (0xFFFFF000) + .equ AT91C_PMC_PCER, (0xFFFFFC10) + .equ AT91C_BASE_PIOA, (0xFFFFF400) + .equ AT91C_ID_PIOA, (2) + .equ PIOA_PDSR, (0x3c) + .equ PIO_BOOTLDR, (1 << 27) + #.equ PIO_BOOTLDR, (1 << 6) + /* #include "AT91SAM7S64_inc.h" */ @@ -170,9 +179,23 @@ _remap: mov r2, #0x01 str r2, [r1, #AIC_MCR_RCR] + /* prepare c function call to main */ mov r0, #0 /* argc = 0 */ ldr lr,=exit ldr r10,=main + +#ifdef CONFIG_DFU_SWITCH + /* check whether bootloader button is pressed */ + ldr r1, =AT91C_PMC_PCER + mov r2, #(1 << AT91C_ID_PIOA) + str r2, [r1] + + ldr r1, =AT91C_BASE_PIOA + ldr r2, [r1, #PIOA_PDSR] + tst r2, #PIO_BOOTLDR + ldrne r10,=dfu_main +#endif + bx r10 .size remap, . - remap .endfunc -- cgit v1.2.3