Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.34 KB | None | 0 0
  1. diff --git a/lmicdiusb/gdb.c b/lmicdiusb/gdb.c
  2. index b1220b6..6990149 100644
  3. --- a/lmicdiusb/gdb.c
  4. +++ b/lmicdiusb/gdb.c
  5. @@ -39,6 +39,7 @@
  6. //*****************************************************************************
  7.  
  8. #include "lmicdi.h"
  9. +#include <ctype.h>
  10.  
  11. //****************************************************************************
  12. //
  13. @@ -103,16 +104,26 @@ gdb_statemachine(GDBCTX *pGdbCtx, unsigned char *pBuf, unsigned int len,
  14. if (*pBuf == '+')
  15. {
  16. pGdbCtx->iAckCount++;
  17. - }
  18. + }
  19. if (*pBuf == '-')
  20. {
  21. pGdbCtx->iNakCount++;
  22. }
  23. + if (*pBuf == 0x03) // handle break from arm-none-eabi-gdb user pressing CTRL-C
  24. + {
  25. + pGdbCtx->iAckCount++;
  26. + pGdbCtx->pResp[pGdbCtx->iRd++] = *pBuf;
  27. + pFn(pGdbCtx, 1);
  28. + pGdbCtx->iRd = 0;
  29. + pGdbCtx->gdb_state = GDB_IDLE;
  30. + pBuf++;
  31. + break;
  32. + }
  33. pGdbCtx->pResp[pGdbCtx->iRd++] = *pBuf;
  34. pBuf++;
  35. break;
  36. case GDB_PAYLOAD:
  37. - TRACE(0, "GDB_PAYLOAD: '%c'\n", *pBuf);
  38. + TRACE(0, "GDB_PAYLOAD: '%c' 0x%02x\n", isprint(*pBuf) ? *pBuf : '.', *pBuf);
  39. pGdbCtx->pResp[pGdbCtx->iRd++] = *pBuf;
  40. if (*pBuf == '#')
  41. {
  42. @@ -200,5 +211,6 @@ usb_callback(struct libusb_transfer *pTrans)
  43.  
  44. default:
  45. TRACE(ALWAYS, "%s: status = 0x%08x\n", __FUNCTION__, pTrans->status);
  46. + break;
  47. }
  48. }
  49. diff --git a/lmicdiusb/lmicdi.c b/lmicdiusb/lmicdi.c
  50. index ad22d8d..80b1970 100644
  51. --- a/lmicdiusb/lmicdi.c
  52. +++ b/lmicdiusb/lmicdi.c
  53. @@ -43,7 +43,10 @@
  54.  
  55. struct libusb_context *pCtx;
  56.  
  57. -unsigned int gTraceLvl = 2;
  58. +#ifndef TRACE_LEVEL
  59. +#define TRACE_LEVEL 2
  60. +#endif
  61. +unsigned int gTraceLvl = TRACE_LEVEL;
  62.  
  63. const struct libusb_endpoint_descriptor *pdEndpIn, *pdEndpOut;
  64. libusb_device_handle *phDev;
  65. @@ -159,7 +162,7 @@ main(int argc, char *argv[])
  66. rc = libusb_init(&pCtx);
  67. ASSERT(rc == 0);
  68.  
  69. - // libusb_set_debug(pCtx, 5);
  70. + libusb_set_debug(pCtx, 5);
  71.  
  72.  
  73. nDevs = libusb_get_device_list(pCtx, &pDevices);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement