Преглед изворни кода

Merge branch 'bugfix/bootloader_custom_console_pins' into 'master'

Fix bootloader build if custom UART pins are used (Github PR + ESP32-S2 + test)

See merge request espressif/esp-idf!7665
Ivan Grokhotkov пре 6 година
родитељ
комит
32ea031b19

+ 1 - 0
components/bootloader_support/src/esp32/bootloader_esp32.c

@@ -26,6 +26,7 @@
 #include "soc/cpu.h"
 #include "soc/dport_reg.h"
 #include "soc/efuse_reg.h"
+#include "soc/gpio_periph.h"
 #include "soc/gpio_sig_map.h"
 #include "soc/io_mux_reg.h"
 #include "soc/rtc.h"

+ 8 - 7
components/bootloader_support/src/esp32s2/bootloader_esp32s2.c

@@ -15,6 +15,7 @@
 #include "sdkconfig.h"
 #include "bootloader_common.h"
 #include "soc/efuse_reg.h"
+#include "soc/gpio_periph.h"
 #include "soc/gpio_sig_map.h"
 #include "soc/io_mux_reg.h"
 #include "esp32s2/rom/efuse.h"
@@ -237,15 +238,15 @@ static void bootloader_init_uart_console(void)
     uart_tx_switch(uart_num);
     // If console is attached to UART1 or if non-default pins are used,
     // need to reconfigure pins using GPIO matrix
-    if (uart_num != 0 || uart_tx_gpio != 1 || uart_rx_gpio != 3) {
-        // Change pin mode for GPIO1/3 from UART to GPIO
-        PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0RXD_U, FUNC_U0RXD_GPIO3);
-        PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0TXD_U, FUNC_U0TXD_GPIO1);
+    if (uart_num != 0 || uart_tx_gpio != 43 || uart_rx_gpio != 44) {
+        // Change pin mode UART to GPIO
+        PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0RXD_U, FUNC_U0RXD_GPIO44);
+        PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0TXD_U, FUNC_U0TXD_GPIO43);
         // Route GPIO signals to/from pins
         // (arrays should be optimized away by the compiler)
-        const uint32_t tx_idx_list[3] = {U0TXD_OUT_IDX, U1TXD_OUT_IDX, U2TXD_OUT_IDX};
-        const uint32_t rx_idx_list[3] = {U0RXD_IN_IDX, U1RXD_IN_IDX, U2RXD_IN_IDX};
-        const uint32_t uart_reset[3] = {DPORT_UART_RST, DPORT_UART1_RST, DPORT_UART2_RST};
+        const uint32_t tx_idx_list[2] = {U0TXD_OUT_IDX, U1TXD_OUT_IDX};
+        const uint32_t rx_idx_list[2] = {U0RXD_IN_IDX, U1RXD_IN_IDX};
+        const uint32_t uart_reset[2] = {DPORT_UART_RST, DPORT_UART1_RST};
         const uint32_t tx_idx = tx_idx_list[uart_num];
         const uint32_t rx_idx = rx_idx_list[uart_num];
 

+ 6 - 0
tools/test_apps/system/build_test/CMakeLists.txt

@@ -0,0 +1,6 @@
+# The following lines of boilerplate have to be in your project's
+# CMakeLists in this exact order for cmake to work correctly
+cmake_minimum_required(VERSION 3.5)
+
+include($ENV{IDF_PATH}/tools/cmake/project.cmake)
+project(test_build)

+ 6 - 0
tools/test_apps/system/build_test/README.txt

@@ -0,0 +1,6 @@
+This project is for testing if the application can be built with a particular sdkconfig setting.
+
+To add new configuration, create one more sdkconfig.ci.NAME file in this directory.
+To make the configuration target-specific, add a CONFIG_IDF_TARGET="name" line.
+
+If you need to test for anything other than building, create another test project.

+ 2 - 0
tools/test_apps/system/build_test/main/CMakeLists.txt

@@ -0,0 +1,2 @@
+idf_component_register(SRCS "test_main.c"
+                       INCLUDE_DIRS ".")

+ 3 - 0
tools/test_apps/system/build_test/main/test_main.c

@@ -0,0 +1,3 @@
+void app_main(void)
+{
+}

+ 1 - 0
tools/test_apps/system/build_test/sdkconfig.ci.custom_uart

@@ -0,0 +1 @@
+CONFIG_ESP_CONSOLE_UART_CUSTOM=y