Minor changes to allow a build for Windows hosts with libftdi.

This commit is contained in:
Gareth McMullin 2011-03-29 20:01:15 +13:00
parent c9ea16312b
commit be91386c0a
10 changed files with 34 additions and 11 deletions

View File

@ -26,7 +26,6 @@
#include <stdlib.h>
#include <string.h>
#include <alloca.h>
#include "general.h"

View File

@ -28,7 +28,6 @@
#include <stdlib.h>
#include <string.h>
#include <alloca.h>
#include <assert.h>
#include "platform.h"

View File

@ -29,8 +29,6 @@
#include <stdarg.h>
#include <alloca.h>
#include "general.h"
#include "gdb_if.h"
#include "gdb_packet.h"

View File

@ -28,8 +28,6 @@
#include <assert.h>
#include <alloca.h>
#include "general.h"
#include "jtagtap.h"
#include "jtag_scan.h"

View File

@ -1 +1 @@
LDFLAGS += -lftdi
LDFLAGS += -lftdi -lusb

View File

@ -23,10 +23,15 @@
* uses a TCP server on port 2000.
*/
#include <stdio.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <sys/select.h>
#ifndef WIN32
# include <sys/socket.h>
# include <netinet/in.h>
# include <sys/select.h>
#else
# include <windows.h>
# include <ws2tcpip.h>
#endif
#include <assert.h>
@ -37,6 +42,10 @@ static int gdb_if_serv, gdb_if_conn;
int gdb_if_init(void)
{
#ifdef WIN32
WSADATA wsaData;
WSAStartup(MAKEWORD(2, 2), &wsaData);
#endif
struct sockaddr_in addr;
addr.sin_family = AF_INET;

View File

@ -31,7 +31,6 @@
#include <string.h>
#include <assert.h>
#include <alloca.h>
#include <ftdi.h>

View File

@ -107,3 +107,17 @@ int platform_buffer_read(uint8_t *data, int size)
return size;
}
#ifdef WIN32
#warning "This vasprintf() is dubious!"
int vasprintf(char **strp, const char *fmt, va_list ap)
{
int size = 128, ret = 0;
*strp = malloc(size);
while(*strp && ((ret = vsnprintf(*strp, size, fmt, ap)) == size))
*strp = realloc(*strp, size <<= 1);
return ret;
}
#endif

View File

@ -24,6 +24,12 @@
#include <stdint.h>
#include <ftdi.h>
#ifndef WIN32
# include <alloca.h>
#else
# define alloca __builtin_alloca
#endif
#define FT2232_VID 0x0403
#define FT2232_PID 0x6010

View File

@ -27,6 +27,7 @@
#include <libopencm3/stm32/gpio.h>
#include <setjmp.h>
#include <alloca.h>
#include "gdb_packet.h"