boot_serial: espressif: ESP32-S2 serial recovery mode interface
Add the serial adapter for ESP32-S2 for boot recovery and MCUMGR
communication.
Signed-off-by: Almir Okato <almir.okato@espressif.com>
diff --git a/boot/espressif/hal/include/esp32s2/esp32s2.cmake b/boot/espressif/hal/include/esp32s2/esp32s2.cmake
index 588ec1c..7afafc6 100644
--- a/boot/espressif/hal/include/esp32s2/esp32s2.cmake
+++ b/boot/espressif/hal/include/esp32s2/esp32s2.cmake
@@ -5,6 +5,7 @@
list(APPEND hal_srcs
${esp_idf_dir}/components/esp_hw_support/port/${MCUBOOT_TARGET}/regi2c_ctrl.c
${esp_idf_dir}/components/efuse/src/esp_efuse_api_key_esp32xx.c
+ ${esp_idf_dir}/components/esp_rom/patches/esp_rom_crc.c
)
list(APPEND LINKER_SCRIPTS
diff --git a/boot/espressif/hal/src/esp32s2/bootloader_init.c b/boot/espressif/hal/src/esp32s2/bootloader_init.c
index 90e329e..a3e4b2f 100644
--- a/boot/espressif/hal/src/esp32s2/bootloader_init.c
+++ b/boot/espressif/hal/src/esp32s2/bootloader_init.c
@@ -14,6 +14,8 @@
#include "esp_rom_gpio.h"
#include "bootloader_init.h"
+#include "bootloader_common.h"
+#include "bootloader_console.h"
#include "bootloader_mem.h"
#include "bootloader_clock.h"
#include "bootloader_flash_config.h"
@@ -120,18 +122,6 @@
return ESP_OK;
}
-static void bootloader_init_uart_console(void)
-{
- const int uart_num = 0;
-
- uartAttach(NULL);
- ets_install_uart_printf();
- uart_tx_wait_idle(0);
-
- const int uart_baud = CONFIG_ESP_CONSOLE_UART_BAUDRATE;
- uart_div_modify(uart_num, (rtc_clk_apb_freq_get() << 4) / uart_baud);
-}
-
static void bootloader_super_wdt_auto_feed(void)
{
REG_SET_BIT(RTC_CNTL_SWD_CONF_REG, RTC_CNTL_SWD_AUTO_FEED_EN);
@@ -158,7 +148,7 @@
/* config clock */
bootloader_clock_configure();
/* initialize uart console, from now on, we can use ets_printf */
- bootloader_init_uart_console();
+ bootloader_console_init();
/* read bootloader header */
if ((ret = bootloader_read_bootloader_header()) != ESP_OK) {
goto err;