Merge pull request #124 from gsmcmullin/windows_fixes

Fixes to allow building for Windows.
This commit is contained in:
Gareth McMullin 2016-04-16 14:49:22 -07:00
commit 2685906fc8
4 changed files with 15 additions and 4 deletions

View File

@ -38,6 +38,9 @@
#include <unistd.h>
/* On some systems this is a macro and causes problems */
#undef errno
static char cortexm_driver_str[] = "ARM Cortex-M";
static bool cortexm_vector_catch(target *t, int argc, char *argv[]);
@ -819,6 +822,10 @@ static bool cortexm_vector_catch(target *t, int argc, char *argv[])
return true;
}
/* Windows defines this with some other meaning... */
#ifdef SYS_OPEN
# undef SYS_OPEN
#endif
/* Semihosting support */
/* ARM Semihosting syscall numbers, from ARM doc DUI0471C, Chapter 8 */

View File

@ -29,6 +29,7 @@
# include <netinet/in.h>
# include <sys/select.h>
#else
# include <winsock2.h>
# include <windows.h>
# include <ws2tcpip.h>
#endif
@ -55,7 +56,7 @@ int gdb_if_init(void)
assert((gdb_if_serv = socket(PF_INET, SOCK_STREAM, 0)) != -1);
opt = 1;
assert(setsockopt(gdb_if_serv, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) != -1);
assert(setsockopt(gdb_if_serv, SOL_SOCKET, SO_REUSEADDR, (void*)&opt, sizeof(opt)) != -1);
assert(bind(gdb_if_serv, (void*)&addr, sizeof(addr)) != -1);
assert(listen(gdb_if_serv, 1) != -1);
@ -76,7 +77,7 @@ unsigned char gdb_if_getchar(void)
gdb_if_conn = accept(gdb_if_serv, NULL, NULL);
DEBUG("Got connection\n");
}
i = recv(gdb_if_conn, &ret, 1, 0);
i = recv(gdb_if_conn, (void*)&ret, 1, 0);
if(i <= 0) {
gdb_if_conn = -1;
DEBUG("Dropped broken connection\n");
@ -111,6 +112,6 @@ void gdb_if_putchar(unsigned char c, int flush)
(void)flush;
if (gdb_if_conn > 0)
send(gdb_if_conn, &c, 1, 0);
send(gdb_if_conn, (void*)&c, 1, 0);
}

View File

@ -22,6 +22,7 @@
#include "version.h"
#include <assert.h>
#include <unistd.h>
#include <sys/time.h>
struct ftdi_context *ftdic;

View File

@ -26,7 +26,9 @@
#ifndef WIN32
# include <alloca.h>
#else
# define alloca __builtin_alloca
# ifndef alloca
# define alloca __builtin_alloca
# endif
#endif
#define FT2232_VID 0x0403