10000 esp32: Use the ESP-IDF default esp_console config for ESP32-C3. · micropython/micropython@0a11832 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0a11832

Browse files
projectgusdpgeorge
authored andcommitted
esp32: Use the ESP-IDF default esp_console config for ESP32-C3.
The ESP-IDF default on C3 is primary UART0, secondary USB serial/jtag. Previously MicroPython configured the primary as USB Serial/JTAG and manually worked with the UART0 console. However UART0 console stopped working this way in v5.2.2. The big change is that CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG is no longer set, as primary console is UART0. However CONFIG_ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG is set and IDF provides a macro CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG_ENABLED which is set if either primary or secondary esp_console is USB serial/jtag. So need to use that macro instead. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
1 parent fbb02d3 commit 0a11832

File tree

9 files changed

+11
-15
lines changed

9 files changed

+11
-15
lines changed

ports/esp32/boards/ESP32_GENERIC_C3/sdkconfig.c3usb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,3 @@ CONFIG_ESP32C3_BROWNOUT_DET=y
33
CONFIG_ESP32C3_BROWNOUT_DET_LVL_SEL_7=
44
CONFIG_ESP32C3_BROWNOUT_DET_LVL_SEL_4=y
55
CONFIG_ESP32C3_BROWNOUT_DET_LVL=4
6-
CONFIG_ESP_CONSOLE_UART_DEFAULT=
7-
CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG=y

ports/esp32/boards/LOLIN_C3_MINI/sdkconfig.board

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,3 @@ CONFIG_ESP32C3_BROWNOUT_DET=y
33
CONFIG_ESP32C3_BROWNOUT_DET_LVL_SEL_7=
44
CONFIG_ESP32C3_BROWNOUT_DET_LVL_SEL_4=y
55
CONFIG_ESP32C3_BROWNOUT_DET_LVL=4
6-
CONFIG_ESP_CONSOLE_UART_DEFAULT=
7-
CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG=y

ports/esp32/machine_pin.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ static mp_obj_t machine_pin_obj_init_helper(const machine_pin_obj_t *self, size_
159159
}
160160
}
161161

162-
#if CONFIG_IDF_TARGET_ESP32C3
162+
#if CONFIG_IDF_TARGET_ESP32C3 && CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG_ENABLED
163163
if (index == 18 || index == 19) {
164164
CLEAR_PERI_REG_MASK(USB_SERIAL_JTAG_CONF0_REG, USB_SERIAL_JTAG_USB_PAD_ENABLE);
165165
}

ports/esp32/machine_pin.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
#define MICROPY_HW_ENABLE_GPIO11 (1)
8888
#define MICROPY_HW_ENABLE_GPIO12 (1)
8989
#define MICROPY_HW_ENABLE_GPIO13 (1)
90-
#if !CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
90+
#if !CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG_ENABLED
9191
#define MICROPY_HW_ENABLE_GPIO18 (1)
9292
#define MICROPY_HW_ENABLE_GPIO19 (1)
9393
#endif

ports/esp32/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ void mp_task(void *pvParameter) {
9999
#if MICROPY_PY_THREAD
100100
mp_thread_init(pxTaskGetStackStart(NULL), MICROPY_TASK_STACK_SIZE / sizeof(uintptr_t));
101101
#endif
102-
#if CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
102+
#if CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG_ENABLED
103103
usb_serial_jtag_init();
104104
#elif CONFIG_USB_OTG_SUPPORTED
105105
usb_init();

ports/esp32/mphalport.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ void check_esp_err_(esp_err_t code, const char *func, const int line, const char
100100

101101
uintptr_t mp_hal_stdio_poll(uintptr_t poll_flags) {
102102
uintptr_t ret = 0;
103-
#if CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
103+
#if CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG_ENABLED
104104
usb_serial_jtag_poll_rx();
105105
#endif
106106
if ((poll_flags & MP_STREAM_POLL_RD) && stdin_ringbuf.iget != stdin_ringbuf.iput) {
@@ -114,7 +114,7 @@ uintptr_t mp_hal_stdio_poll(uintptr_t poll_flags) {
114114

115115
int mp_hal_stdin_rx_chr(void) {
116116
for (;;) {
117-
#if CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
117+
#if CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG_ENABLED
118118
usb_serial_jtag_poll_rx();
119119
#endif
120120
int c = ringbuf_get(&stdin_ringbuf);
@@ -133,7 +133,7 @@ mp_uint_t mp_hal_stdout_tx_strn(const char *str, size_t len) {
133133
if (release_gil) {
134134
MP_THREAD_GIL_EXIT();
135135
}
136-
#if CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
136+
#if CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG_ENABLED
137137
usb_serial_jtag_tx_strn(str, len);
138138
did_write = true;
139139
#elif CONFIG_USB_OTG_SUPPORTED

ports/esp32/uart.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
// Whether to enable the REPL on a UART.
3232
#ifndef MICROPY_HW_ENABLE_UART_REPL
33-
#define MICROPY_HW_ENABLE_UART_REPL (!CONFIG_USB_OTG_SUPPORTED && !CONFIG_ESP_CONSOLE_USB_CDC && !CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG)
33+
#define MICROPY_HW_ENABLE_UART_REPL (!CONFIG_USB_OTG_SUPPORTED && !CONFIG_ESP_CONSOLE_USB_CDC && !CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG_ENABLED)
3434
#endif
3535

3636
#if MICROPY_HW_ENABLE_UART_REPL

ports/esp32/usb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#include "py/mphal.h"
2929
#include "usb.h"
3030

31-
#if CONFIG_USB_OTG_SUPPORTED && !CONFIG_ESP_CONSOLE_USB_CDC && !CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
31+
#if CONFIG_USB_OTG_SUPPORTED && !CONFIG_ESP_CONSOLE_USB_CDC && !CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG_ENABLED
3232

3333
#include "esp_timer.h"
3434
#ifndef NO_QSTR
@@ -100,4 +100,4 @@ void usb_tx_strn(const char *str, size_t len) {
100100
}
101101
}
102102

103-
#endif // CONFIG_USB_OTG_SUPPORTED && !CONFIG_ESP_CONSOLE_USB_CDC && !CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
103+
#endif // CONFIG_USB_OTG_SUPPORTED && !CONFIG_ESP_CONSOLE_USB_CDC && !CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG_ENABLED

ports/esp32/usb_serial_jtag.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#include "py/mphal.h"
2929
#include "usb_serial_jtag.h"
3030

31-
#if CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
31+
#if CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG_ENABLED
3232

3333
#include "hal/usb_serial_jtag_ll.h"
3434
#include "esp_intr_alloc.h"
@@ -117,4 +117,4 @@ void usb_serial_jtag_tx_strn(const char *str, size_t len) {
117117
}
118118
}
119119

120-
#endif // CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
120+
#endif // CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG_ENABLED

0 commit comments

Comments
 (0)
0