Skip to content

Commit

Permalink
esp32 serial_jtag debugger connection improvements (#1299)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkellner committed Feb 2, 2024
1 parent 70f8bf1 commit 38d19ac
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
4 changes: 3 additions & 1 deletion build/devices/esp32/xsProj-esp32c3/main/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2023 Moddable Tech, Inc.
* Copyright (c) 2016-2024 Moddable Tech, Inc.
*
* This file is part of the Moddable SDK Runtime.
*
Expand Down Expand Up @@ -45,6 +45,7 @@
#if USE_USB
#if USE_USB == 2
#include "driver/usb_serial_jtag.h"
#include "hal/usb_serial_jtag_ll.h"
#else
#error esp32c3 doesnt support TinyUSB
#endif
Expand Down Expand Up @@ -120,6 +121,7 @@ static void debug_task(void *pvParameter)

while (true) {
fxReceiveLoop();
usb_serial_jtag_ll_txfifo_flush();
modDelayMilliseconds(5);
}
}
Expand Down
6 changes: 4 additions & 2 deletions build/devices/esp32/xsProj-esp32c6/main/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2023 Moddable Tech, Inc.
* Copyright (c) 2016-2024 Moddable Tech, Inc.
*
* This file is part of the Moddable SDK Runtime.
*
Expand Down Expand Up @@ -70,6 +70,7 @@
#include "tusb_cdc_acm.h"
#elif (USE_USB == 2)
#include "driver/usb_serial_jtag.h"
#include "hal/usb_serial_jtag_ll.h"
#endif
#else
#include "driver/uart.h"
Expand Down Expand Up @@ -214,6 +215,7 @@ static void debug_task(void *pvParameter)

#elif (USE_USB == 2)
fxReceiveLoop();
usb_serial_jtag_ll_txfifo_flush();
modDelayMilliseconds(5);

#else // !USE_USB
Expand Down Expand Up @@ -420,7 +422,7 @@ void ESP_put(uint8_t *c, int count) {
void ESP_putc(int c) {
char cx = c;
#if (USE_USB == 2)
usb_serial_jtag_write_bytes(&cx, 1, 1);
usb_serial_jtag_write_bytes(&cx, 1, 1);
#else
uart_write_bytes(USE_UART, &cx, 1);
#endif
Expand Down
4 changes: 3 additions & 1 deletion build/devices/esp32/xsProj-esp32h2/main/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2023 Moddable Tech, Inc.
* Copyright (c) 2016-2024 Moddable Tech, Inc.
*
* This file is part of the Moddable SDK Runtime.
*
Expand Down Expand Up @@ -70,6 +70,7 @@
#include "tusb_cdc_acm.h"
#elif (USE_USB == 2)
#include "driver/usb_serial_jtag.h"
#include "hal/usb_serial_jtag_ll.h"
#endif
#else
#include "driver/uart.h"
Expand Down Expand Up @@ -214,6 +215,7 @@ static void debug_task(void *pvParameter)

#elif (USE_USB == 2)
fxReceiveLoop();
usb_serial_jtag_ll_txfifo_flush();
modDelayMilliseconds(5);

#else // !USE_USB
Expand Down
7 changes: 4 additions & 3 deletions build/devices/esp32/xsProj-esp32s3/main/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2023 Moddable Tech, Inc.
* Copyright (c) 2016-2024 Moddable Tech, Inc.
*
* This file is part of the Moddable SDK Runtime.
*
Expand Down Expand Up @@ -69,6 +69,7 @@
#include "tusb_cdc_acm.h"
#elif (USE_USB == 2)
#include "driver/usb_serial_jtag.h"
#include "hal/usb_serial_jtag_ll.h"
#endif
#else
#include "driver/uart.h"
Expand Down Expand Up @@ -213,8 +214,8 @@ static void debug_task(void *pvParameter)

#elif (USE_USB == 2)
fxReceiveLoop();
usb_serial_jtag_ll_txfifo_flush();
modDelayMilliseconds(5);

#else // !USE_USB

uart_event_t event;
Expand Down Expand Up @@ -419,7 +420,7 @@ WEAK void ESP_put(uint8_t *c, int count) {
WEAK void ESP_putc(int c) {
char cx = c;
#if (USE_USB == 2)
usb_serial_jtag_write_bytes(&cx, 1, 1);
usb_serial_jtag_write_bytes(&cx, 1, 1);
#else
uart_write_bytes(USE_UART, &cx, 1);
#endif
Expand Down

0 comments on commit 38d19ac

Please sign in to comment.