LIBFTDI: Propagate the command line arguments to platform_init

This commit is contained in:
Uwe Bonnes 2012-11-04 12:03:35 +01:00
parent 73d120577b
commit ce059cc8ed
5 changed files with 14 additions and 6 deletions

View File

@ -21,10 +21,12 @@
#ifndef __GDB_IF_H
#define __GDB_IF_H
#if !defined(LIBFTDI)
#include <libopencm3/usb/usbd.h>
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);

View File

@ -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();

View File

@ -1 +1,2 @@
CFLAGS += -DLIBFTDI
LDFLAGS += -lftdi -lusb

View File

@ -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;

View File

@ -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);