summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/Makefile.dfu4
-rw-r--r--firmware/src/dfu/dbgu.c24
-rw-r--r--firmware/src/dfu/dbgu.h12
-rw-r--r--firmware/src/dfu/dfu.c18
4 files changed, 30 insertions, 28 deletions
diff --git a/firmware/Makefile.dfu b/firmware/Makefile.dfu
index d7ca713..99cd1b1 100644
--- a/firmware/Makefile.dfu
+++ b/firmware/Makefile.dfu
@@ -76,7 +76,7 @@ SRC =
# List C source files here which must be compiled in ARM-Mode.
# use file-extension c for "c-only"-files
-SRCARM = src/start/Cstartup_SAM7.c \
+SRCARM = src/start/Cstartup_SAM7.c lib/lib_AT91SAM7.c \
src/dfu/dfu.c src/dfu/dbgu.c src/dfu/flash.c
# List C++ source files here.
@@ -101,7 +101,7 @@ ASRC =
ASRCARM = src/start/Cstartup.S
ifeq ($(DEBUG),1)
-SRCARM += lib/lib_AT91SAM7.c lib/vsprintf.c lib/ctype.c lib/string.c
+SRCARM += lib/vsprintf.c lib/ctype.c lib/string.c
ASRCARM += lib/div64.S
endif
diff --git a/firmware/src/dfu/dbgu.c b/firmware/src/dfu/dbgu.c
index 367a399..9bfefc3 100644
--- a/firmware/src/dfu/dbgu.c
+++ b/firmware/src/dfu/dbgu.c
@@ -24,8 +24,6 @@
#include <stdio.h>
#include <string.h>
-#ifdef DEBUG
-
#define USART_SYS_LEVEL 4
void AT91F_DBGU_Ready(void)
{
@@ -70,7 +68,6 @@ void AT91F_DBGU_Init(void)
DBGU_irq_handler);
AT91F_AIC_EnableIt(AT91C_BASE_AIC, AT91C_ID_SYS);
- AT91F_DBGU_Printk("\n\rsam7dfu (C) 2006 by Harald Welte\n\r");
}
void AT91F_DBGU_Printk(char *buffer)
@@ -81,6 +78,18 @@ void AT91F_DBGU_Printk(char *buffer)
}
}
+int AT91F_DBGU_Get(char *val)
+{
+ if ((AT91F_US_RxReady((AT91PS_USART) AT91C_BASE_DBGU)) == 0)
+ return (0);
+ else {
+ *val = AT91F_US_GetChar((AT91PS_USART) AT91C_BASE_DBGU);
+ return (-1);
+ }
+}
+
+#ifdef DEBUG
+
void AT91F_DBGU_Frame(char *buffer)
{
unsigned char len;
@@ -91,15 +100,6 @@ void AT91F_DBGU_Frame(char *buffer)
(unsigned char *)buffer, len, 0, 0);
}
-int AT91F_DBGU_Get(char *val)
-{
- if ((AT91F_US_RxReady((AT91PS_USART) AT91C_BASE_DBGU)) == 0)
- return (0);
- else {
- *val = AT91F_US_GetChar((AT91PS_USART) AT91C_BASE_DBGU);
- return (-1);
- }
-}
const char *
hexdump(const void *data, unsigned int len)
diff --git a/firmware/src/dfu/dbgu.h b/firmware/src/dfu/dbgu.h
index 9f4f002..358a066 100644
--- a/firmware/src/dfu/dbgu.h
+++ b/firmware/src/dfu/dbgu.h
@@ -7,21 +7,19 @@
#define DEBUGPCR(x, args ...) DEBUGP(x "\r\n", ## args)
#define DEBUGPCRF(x, args ...) DEBUGPCR("%s(%d): " x, __FUNCTION__, __LINE__, ## args)
+extern void AT91F_DBGU_Init(void);
+extern void AT91F_DBGU_Printk(char *buffer);
+extern int AT91F_DBGU_Get(char *val);
+extern void AT91F_DBGU_Ready(void);
+
#ifdef DEBUG
extern void debugp(const char *format, ...);
extern const char *hexdump(const void *data, unsigned int len);
-extern void AT91F_DBGU_Init(void);
-extern void AT91F_DBGU_Printk(char *buffer);
extern void AT91F_DBGU_Frame(char *buffer);
-extern int AT91F_DBGU_Get(char *val);
#else
#define debugp(x, args ...)
#define hexdump(x, args ...)
-#define AT91F_DBGU_Get(x, args ...) 0;
#define AT91F_DBGU_Frame(x)
-#define AT91F_DBGU_Printk(x)
-#define AT91F_DBGU_Init()
-#define AT91F_DBGU_Ready()
#endif
#endif /* dbgu_h */
diff --git a/firmware/src/dfu/dfu.c b/firmware/src/dfu/dfu.c
index 693f2eb..7e7c575 100644
--- a/firmware/src/dfu/dfu.c
+++ b/firmware/src/dfu/dfu.c
@@ -808,7 +808,6 @@ static __dfufunc void dfu_udp_irq(void)
AT91F_AIC_ClearIt(AT91C_BASE_AIC, AT91C_ID_UDP);
- { volatile int i; for (i=0; i< 0x3ff; i++) ; }
led1off();
}
@@ -817,6 +816,7 @@ static void dfu_switch(void)
{
AT91PS_AIC pAic = AT91C_BASE_AIC;
+ DEBUGE("\r\nsam7dfu: switching to DFU mode\r\n");
AT91F_PIO_CfgOutput(AT91C_BASE_PIOA, OPENPCD_PIO_LED1);
AT91F_PIO_CfgOutput(AT91C_BASE_PIOA, OPENPCD_PIO_LED2);
led1off();
@@ -830,6 +830,9 @@ static void dfu_switch(void)
pAic->AIC_SVR[AT91C_ID_UDP] = (unsigned int) &dfu_udp_irq;
dfu_state = DFU_STATE_dfuIDLE;
dfu_status = DFU_STATUS_OK;
+ //AT91F_DBGU_Printk("You may now start the DFU up/download process\r\n");
+ AT91F_DBGU_Printk("\r\nTHIS DOES NOT WORK YET, "
+ " PLEASE PUSH THE BUTTON WHILE POWERING UP\r\n");
}
void __dfufunc dfu_main(void)
@@ -840,11 +843,12 @@ void __dfufunc dfu_main(void)
led2off();
AT91F_DBGU_Init();
- DEBUGE("sam7dfu startup\r\n");
-
- AT91F_DBGU_Printk("\n\r");
- AT91F_DBGU_Printk(COMPILE_DATE " " COMPILE_BY " " COMPILE_SVNREV);
- AT91F_DBGU_Printk("\n\r");
+ AT91F_DBGU_Printk("\n\r\n\rsam7dfu - AT91SAM7 USB DFU bootloader\n\r"
+ "(C) 2006 by Harald Welte <hwelte@hmw-consulting.de>\n\r"
+ "This software is FREE SOFTWARE licensed under GNU GPL\n\r");
+ AT91F_DBGU_Printk("Version " COMPILE_SVNREV
+ " compiled " COMPILE_DATE
+ " by " COMPILE_BY "\n\r\n\r");
udp_init();
@@ -871,7 +875,7 @@ void __dfufunc dfu_main(void)
flash_init();
- DEBUGE("sam7dfu entering main loop\r\n");
+ AT91F_DBGU_Printk("You may now start the DFU up/download process\r\n");
/* do nothing, since all of DFU is interrupt driven */
while (1) ;
}
personal git repositories of Harald Welte. Your mileage may vary