From ce059cc8edee9163fb5f9517468e337616932471 Mon Sep 17 00:00:00 2001 From: Uwe Bonnes Date: Sun, 4 Nov 2012 12:03:35 +0100 Subject: [PATCH] LIBFTDI: Propagate the command line arguments to platform_init --- src/include/gdb_if.h | 4 +++- src/main.c | 9 +++++++-- src/platforms/libftdi/Makefile.inc | 1 + src/platforms/libftdi/platform.c | 2 +- src/platforms/libftdi/platform.h | 4 ++-- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/include/gdb_if.h b/src/include/gdb_if.h index 0d6a602..3307454 100644 --- a/src/include/gdb_if.h +++ b/src/include/gdb_if.h @@ -21,10 +21,12 @@ #ifndef __GDB_IF_H #define __GDB_IF_H +#if !defined(LIBFTDI) #include +void gdb_usb_out_cb(usbd_device *dev, uint8_t ep); +#endif int gdb_if_init(void); -void gdb_usb_out_cb(usbd_device *dev, uint8_t ep); unsigned char gdb_if_getchar(void); unsigned char gdb_if_getchar_to(int timeout); void gdb_if_putchar(unsigned char c, int flush); diff --git a/src/main.c b/src/main.c index 4b46764..4921aed 100644 --- a/src/main.c +++ b/src/main.c @@ -34,10 +34,15 @@ #include "target.h" int -main(void) +main(int argc, char **argv) { +#if defined(LIBFTDI) + assert(platform_init(argc, argv) == 0); +#else + (void) argc; + (void) argv; assert(platform_init() == 0); - +#endif PLATFORM_SET_FATAL_ERROR_RECOVERY(); gdb_main(); diff --git a/src/platforms/libftdi/Makefile.inc b/src/platforms/libftdi/Makefile.inc index 095b3a7..fa6292b 100644 --- a/src/platforms/libftdi/Makefile.inc +++ b/src/platforms/libftdi/Makefile.inc @@ -1 +1,2 @@ +CFLAGS += -DLIBFTDI LDFLAGS += -lftdi -lusb diff --git a/src/platforms/libftdi/platform.c b/src/platforms/libftdi/platform.c index bcf742c..2b541e2 100644 --- a/src/platforms/libftdi/platform.c +++ b/src/platforms/libftdi/platform.c @@ -32,7 +32,7 @@ struct ftdi_context *ftdic; static uint8_t outbuf[BUF_SIZE]; static uint16_t bufptr = 0; -int platform_init(void) +int platform_init(int argc, char **argv) { int err; diff --git a/src/platforms/libftdi/platform.h b/src/platforms/libftdi/platform.h index 5639358..e23bf96 100644 --- a/src/platforms/libftdi/platform.h +++ b/src/platforms/libftdi/platform.h @@ -40,12 +40,12 @@ #define PLATFORM_FATAL_ERROR(error) abort() #define PLATFORM_SET_FATAL_ERROR_RECOVERY() -#define morse(x, y) do {} while(0) +#define morse(x, y) fprintf(stderr,"%s\n", x) #define morse_msg 0 extern struct ftdi_context *ftdic; -int platform_init(void); +int platform_init(int argc, char **argv); const char *platform_target_voltage(void); void platform_delay(uint32_t delay);