fraucheky update and support --vidpid for emulation.
authorNIIBE Yutaka <gniibe@fsij.org>
Wed, 11 Oct 2017 01:49:52 +0000 (10:49 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Wed, 11 Oct 2017 01:49:52 +0000 (10:49 +0900)
ChangeLog
fraucheky
src/Makefile
src/configure
src/main.c

index e2387be..869481a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2017-10-11  NIIBE Yutaka  <gniibe@fsij.org>
+
+       * src/main.c [GNU_LINUX_EMULATION] (main): Support --vidpid
+       option.
+
+       * fraucheky: Update to 0.5.
+
 2017-10-10  NIIBE Yutaka  <gniibe@fsij.org>
 
        * src/configure: Allow not specifying VIDPID.
index 2b2907a..08c4901 160000 (submodule)
--- a/fraucheky
+++ b/fraucheky
@@ -1 +1 @@
-Subproject commit 2b2907af4cdf91954fee48ce8ba7d0d931f77915
+Subproject commit 08c490122008f7eae6911648c0a62d0656835351
index 198de4a..0d6db4b 100644 (file)
@@ -10,6 +10,7 @@ CSRC = main.c sha256.c neug.c
 
 include config.mk
 
+USE_SYS = yes
 USE_USB = yes
 USE_ADC = yes
 
index ed3aa44..dd6ed28 100755 (executable)
@@ -208,7 +208,6 @@ esac
 if test "$target" = "GNU_LINUX"; then
   ldscript=""
   chip="gnu-linux"
-  use_sys="yes"
   emulation="yes"
   cross=""
   mcu="none"
@@ -218,7 +217,6 @@ if test "$target" = "GNU_LINUX"; then
 else
   ldscript="neug.ld"
   chip="stm32f103"
-  use_sys="yes"
   emulation=""
   cross="arm-none-eabi-"
   mcu="cortex-m3"
@@ -364,7 +362,6 @@ fi
 
 
 (echo "CHIP=$chip";
- echo "USE_SYS=$use_sys";
  echo "EMULATION=$emulation";
  echo "CROSS=$cross";
  echo "MCU=$mcu";
index bee6537..280d49d 100644 (file)
@@ -34,6 +34,7 @@
 #include "usb_lld.h"
 #include "sys.h"
 #ifdef GNU_LINUX_EMULATION
+#include <stdio.h>
 #include <stdlib.h>
 #define main emulated_main
 #else
@@ -76,7 +77,11 @@ static uint8_t connected;
 #define USB_CDC_REQ_SEND_BREAK                  0x23
 
 /* USB Device Descriptor */
-static const uint8_t vcom_device_desc[18] = {
+static
+#if !defined(GNU_LINUX_EMULATION)
+const
+#endif
+uint8_t vcom_device_desc[18] = {
   18,   /* bLength */
   DEVICE_DESCRIPTOR,           /* bDescriptorType */
   0x10, 0x01,                  /* bcdUSB = 1.1 */
@@ -1082,8 +1087,43 @@ main (int argc, char **argv)
   chopstx_t led_thread, usb_thd;
   unsigned int count;
 
+#ifdef GNU_LINUX_EMULATION
+  if (argc >= 4 || (argc == 2 && !strcmp (argv[1], "--help")))
+    {
+      fprintf (stdout, "Usage: %s [--vidpid=Vxxx:Pxxx]", argv[0]);
+      exit (0);
+    }
+
+  if (argc >= 2 && !strncmp (argv[1], "--debug=", 8))
+    {
+      debug = strtol (&argv[1][8], NULL, 10);
+      argc--;
+      argv++;
+    }
+
+  if (argc >= 2 && !strncmp (argv[1], "--vidpid=", 9))
+    {
+      uint32_t id;
+      char *p;
+
+      id = (uint32_t)strtol (&argv[1][9], &p, 16);
+      vcom_device_desc[8] = (id & 0xff);
+      vcom_device_desc[9] = (id >> 8);
+
+      if (p && p[0] == ':')
+       {
+         id = (uint32_t)strtol (&p[1], NULL, 16);
+         vcom_device_desc[10] = (id & 0xff);
+         vcom_device_desc[11] = (id >> 8);
+       }
+
+      argc--;
+      argv++;
+    }
+#else
   (void)argc;
   (void)argv;
+#endif
 
   fill_serial_no_by_unique_id ();