Rev 2403 fails on Windows/MinGW, because:

1. there is no strtok_r(), but strtok() is reentrant, so use that
patch file -> win32-strtok.patch

That was discussed earlier in "[Openocd-development] [Openocd-svn] r2381 - trunk/src/helper" thread

2. alloca() needs malloc.h included
patch file -> win32-alloca.patch

These two patches fix Windows/MinGW build, please test and commit (;

4\/3!!
Index: src/helper/membuf.c
===================================================================
--- src/helper/membuf.c (revision 2403)
+++ src/helper/membuf.c (working copy)
@@ -25,6 +25,13 @@
 
 #include "membuf.h"
 
+/*
+ * Win32 plaftorm doesn't have strtok_r(), but strtok() is reentrant
+ */
+#ifdef _WIN32
+#define strtok_r(source, delimiters, lasts)    strtok(source, delimiters)
+#endif
+
 struct membuf {
     // buflen is alway "+1" bigger then
     // what is shown here, the +1 is for
Index: src/flash/at91sam3.c
===================================================================
--- src/flash/at91sam3.c        (revision 2403)
+++ src/flash/at91sam3.c        (working copy)
@@ -56,6 +56,12 @@
 #include "config.h"
 #endif
 
+/*
+ * Win32 platform has alloca() in malloc.h
+ */
+#ifdef _WIN32
+#include <malloc.h>
+#endif
 
 #include <stdio.h>
 #include <string.h>
_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to