diff --git a/cpu/esp32/bootloader/sdkconfig.h b/cpu/esp32/bootloader/sdkconfig.h index 536a5c7163..93cab5f7f7 100644 --- a/cpu/esp32/bootloader/sdkconfig.h +++ b/cpu/esp32/bootloader/sdkconfig.h @@ -85,7 +85,25 @@ extern "C" { * Bootloader output baudrate, defined by the app settings as BAUD or * BOOTLOADER_BAUD. */ -#define CONFIG_ESP_CONSOLE_UART_BAUDRATE (RIOT_BOOTLOADER_BAUD) +#define CONFIG_ESP_CONSOLE_UART_BAUDRATE (RIOT_BOOTLOADER_BAUD) + +/* + * If custom TX and RX are defined, use custom UART configuration for 2nd stage + * bootloader. + */ +#if defined(CONFIG_CONSOLE_UART_RX) && defined(CONFIG_CONSOLE_UART_RX) +#define CONFIG_ESP_CONSOLE_UART_CUSTOM 1 +#define CONFIG_ESP_CONSOLE_UART_TX_GPIO CONFIG_CONSOLE_UART_TX +#define CONFIG_ESP_CONSOLE_UART_RX_GPIO CONFIG_CONSOLE_UART_RX +#else +#define CONFIG_ESP_CONSOLE_UART_DEFAULT 1 +#endif + +#if defined(CONFIG_CONSOLE_UART_NUM) +#define CONFIG_ESP_CONSOLE_UART_NUM CONFIG_CONSOLE_UART_NUM +#else +#define CONFIG_ESP_CONSOLE_UART_NUM 0 +#endif #ifdef __cplusplus } diff --git a/cpu/esp32/bootloader/sdkconfig_default_common.h b/cpu/esp32/bootloader/sdkconfig_default_common.h index ed2e759998..9dcdd78d93 100644 --- a/cpu/esp32/bootloader/sdkconfig_default_common.h +++ b/cpu/esp32/bootloader/sdkconfig_default_common.h @@ -33,11 +33,6 @@ extern "C" { #define CONFIG_BOOTLOADER_FLASH_XMC_SUPPORT 1 #define CONFIG_ESP_CONSOLE_UART 1 -#define CONFIG_ESP_CONSOLE_UART_DEFAULT 1 -#define CONFIG_ESP_CONSOLE_UART_NUM 0 - -#define CONFIG_CONSOLE_UART_NUM CONFIG_ESP_CONSOLE_UART_NUM -#define CONFIG_CONSOLE_UART_DEFAULT CONFIG_ESP_CONSOLE_UART_DEFAULT #define CONFIG_LOG_DEFAULT_LEVEL 3 #define CONFIG_LOG_TIMESTAMP_SOURCE_RTOS 1