SRC=log.c boot.c protocol.c devices.c memory.c
-WINDOWS=0
+WINDOWS=1
ifeq ($(WINDOWS),1)
PREFIX=i686-w64-mingw32-
SRC += serial-win.c
-CFLAGS += -static -mwindows
+CFLAGS += -static #-mwindows
else
CFLAGS += -fPIC -static #-m32
SRC += serial.c
#define PORT_NAME "/dev/ttyUSB0"
#endif
-#ifdef _WIN32
-static void keypress(void)
-{
- printf("Press ENTER to exit\n");
- getchar();
-}
-#else
-static void keypress(void) {}
-#endif
-
-
void usage(const char * name)
{
loge("Usage: %s [-b baud] [-p port] [-i] [-v] {file.hex}\n", name);
if (!idonly && optind >= argc) {
loge("Error: missing hexfile");
- keypress();
return 1;
}
FILE * fd = NULL;
if ((fd = fopen(argv[optind], "r"))==NULL) {
loge("Error opening %s: %s", argv[optind], strerror(errno));
- keypress();
return 1;
}
ram = load_ihex(fd);
logd("open serial port %s at %d baud", port, baud);
port_t * pt = serial_open(port, baud);
if (pt == NULL) {
- keypress();
return 1;
}
uint16_t maxmem;
uint16_t devid;
if (loader_connect(pt, &maxmem, &devid)) {
- keypress();
return 1;
}
logi(" Max Mem: %d", dev->memsize );
}
- keypress();
return 0;
}
if (dev) logd("Device Name: %s", dev->name);
/* check that the selected program will fit on this device */
if (makesafe_mem(&ram, maxmem)) {
serial_close(pt);
- keypress();
return 1;
}
logd("After re-organisation");
/* finished */
serial_close(pt);
logd("done.");
- keypress();
return 0;
}
{
static int hConHandle = 0;
- if (hConHandle == 0) {
+ if (0 && hConHandle == 0) {
CONSOLE_SCREEN_BUFFER_INFO coninfo;
AllocConsole();
- //AttachConsole(ATTACH_PARENT_PROCESS);
+ if (AttachConsole(ATTACH_PARENT_PROCESS) == ERROR_INVALID_HANDLE) {
+ AllocConsole();
+ }
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &coninfo);
coninfo.dwSize.Y = MAX_CONSOLE_LINES;
SetConsoleScreenBufferSize(GetStdHandle(STD_OUTPUT_HANDLE), coninfo.dwSize);