aboutsummaryrefslogtreecommitdiff
path: root/src/platforms
diff options
context:
space:
mode:
authorGareth McMullin2014-08-06 12:38:57 +1200
committerGareth McMullin2014-08-06 12:38:57 +1200
commit84fc40085ea825e890d65ce4e5e4d87b51ea588d (patch)
tree14e033e28b832558bfb529102bed1a5062d13a0e /src/platforms
parentd265b7600166fc829fa74f7ffdb1fa8e2fb31e84 (diff)
Send a null packet on end of USB transfer if last data packet is full.
Diffstat (limited to 'src/platforms')
-rw-r--r--src/platforms/stm32/gdb_if.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/platforms/stm32/gdb_if.c b/src/platforms/stm32/gdb_if.c
index 3ea7d14..28bc4c8 100644
--- a/src/platforms/stm32/gdb_if.c
+++ b/src/platforms/stm32/gdb_if.c
@@ -47,6 +47,18 @@ void gdb_if_putchar(unsigned char c, int flush)
}
while(usbd_ep_write_packet(usbdev, CDCACM_GDB_ENDPOINT,
buffer_in, count_in) <= 0);
+
+ if (flush && (count_in == CDCACM_PACKET_SIZE)) {
+ /* We need to send an empty packet for some hosts
+ * to accept this as a complete transfer. */
+ /* libopencm3 needs a change for us to confirm when
+ * that transfer is complete, so we just send a packet
+ * containing a null byte for now.
+ */
+ while (usbd_ep_write_packet(usbdev, CDCACM_GDB_ENDPOINT,
+ "\0", 1) <= 0);
+ }
+
count_in = 0;
}
}