Get the Windows build working.
This commit is contained in:
parent
5412955a7b
commit
eac9af39e2
32
Makefile
32
Makefile
@ -44,7 +44,7 @@ $(OBJDIR)/p1load.o \
|
||||
$(OBJDIR)/ploader.o \
|
||||
$(foreach x, $(OSINT), $(OBJDIR)/$(x).o)
|
||||
|
||||
CFLAGS+=-Wall
|
||||
CFLAGS+=-Wall -DOS_$(OS)
|
||||
LDFLAGS=$(CFLAGS)
|
||||
|
||||
.PHONY: default
|
||||
@ -53,34 +53,20 @@ default: $(TARGET)
|
||||
DIRS=$(OBJDIR) $(BINDIR)
|
||||
|
||||
$(TARGET): $(BINDIR) $(OBJDIR) $(OBJS)
|
||||
@$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
|
||||
@$(ECHO) link $@
|
||||
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
|
||||
|
||||
$(OBJDIR)/%.o: $(SRCDIR)/%.c $(HDRS) $(OBJDIR)
|
||||
@$(CC) $(CFLAGS) -c $< -o $@
|
||||
@$(ECHO) $(CC) $@
|
||||
|
||||
$(OBJDIR)/%.o: $(OBJDIR)/%.c $(HDRS) $(OBJDIR)
|
||||
@$(CC) $(CFLAGS) -c $< -o $@
|
||||
@$(ECHO) $(CC) $@
|
||||
|
||||
.PHONY: bin2c
|
||||
bin2c: $(BINDIR)/bin2c$(EXT)
|
||||
|
||||
$(BINDIR)/bin2c$(EXT): $(SRCDIR)/tools/bin2c.c $(BINDIR)
|
||||
@$(CC) $(CFLAGS) $(LDFLAGS) $(SRCDIR)/tools/bin2c.c -o $@
|
||||
@$(ECHO) cc $@
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
$(DIRS):
|
||||
$(MKDIR) $@
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
@$(RM) -f -r $(OBJDIR)
|
||||
@$(RM) -f -r $(PROPOBJDIR)
|
||||
@$(RM) -f -r $(BINDIR)
|
||||
$(RM) -f -r $(OBJDIR)
|
||||
$(RM) -f -r $(BINDIR)
|
||||
|
||||
.PHONY:
|
||||
clean-all: clean
|
||||
@$(RM) -f -r obj
|
||||
@$(RM) -f -r bin
|
||||
.PHONY: clean-all
|
||||
clean-all:
|
||||
$(RM) -f -r obj
|
||||
$(RM) -f -r bin
|
||||
|
@ -30,6 +30,8 @@
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
************************************************************************/
|
||||
|
||||
#define INITGUID
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <windows.h>
|
||||
@ -37,9 +39,7 @@
|
||||
#include <objbase.h>
|
||||
#include <setupapi.h>
|
||||
|
||||
#ifndef GUID_DEVINTERFACE_COMPORT
|
||||
DEFINE_GUID(GUID_DEVINTERFACE_COMPORT, 0x86e0d1e0L, 0x8089, 0x11d0, 0x9c, 0xe4, 0x08, 0x00, 0x3e, 0x30, 0x1f, 0x73);
|
||||
#endif
|
||||
|
||||
#ifdef MAIN
|
||||
int CheckPort(const char* port, void* data)
|
||||
|
2
p1load.c
2
p1load.c
@ -1,8 +1,8 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
#include "ploader.h"
|
||||
#include "osint.h"
|
||||
|
18
ploader.c
18
ploader.c
@ -1,3 +1,8 @@
|
||||
#ifdef OS_msys
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#include <time.h>
|
||||
#endif
|
||||
#include "ploader.h"
|
||||
|
||||
#ifndef TRUE
|
||||
@ -7,6 +12,7 @@
|
||||
|
||||
#define ACK_TIMEOUT 20
|
||||
|
||||
static int ms_sleep(unsigned long msecs);
|
||||
static void SerialInit(PL_state *state);
|
||||
static void TByte(PL_state *state, uint8_t x);
|
||||
static void TLong(PL_state *state, uint32_t x);
|
||||
@ -36,7 +42,7 @@ int PL_LoadSpinBinary(PL_state *state, int loadType, uint8_t *image, int size)
|
||||
TLong(state, data);
|
||||
}
|
||||
TComm(state);
|
||||
usleep(1000);
|
||||
ms_sleep(1);
|
||||
|
||||
/* wait for an ACK */
|
||||
while (--retries >= 0) {
|
||||
@ -51,6 +57,16 @@ int PL_LoadSpinBinary(PL_state *state, int loadType, uint8_t *image, int size)
|
||||
return retries >= 0 ? 0 : -1;
|
||||
}
|
||||
|
||||
static int ms_sleep(unsigned long msecs)
|
||||
{
|
||||
struct timespec req;
|
||||
req.tv_sec = (int)(msecs / 1000L);
|
||||
req.tv_nsec = (msecs - (req.tv_sec * 1000)) * 1000000L;
|
||||
while (nanosleep(&req, &req) < 0)
|
||||
;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* this code is adapted from Chip Gracey's PNut IDE */
|
||||
|
||||
int PL_HardwareFound(PL_state *state, int *pVersion)
|
||||
|
Loading…
Reference in New Issue
Block a user