bootloader: combine console code for ESP32 and S2, add USB support

This commit is contained in:
Ivan Grokhotkov
2020-04-30 15:30:15 +02:00
parent 5ee75165f2
commit 6dfb2d83a7
7 changed files with 137 additions and 2 deletions

View File

@@ -63,6 +63,7 @@
#include "bootloader_common.h"
#include "bootloader_utility.h"
#include "bootloader_sha.h"
#include "bootloader_console.h"
#include "esp_efuse.h"
static const char *TAG = "boot";
@@ -757,6 +758,7 @@ static void set_cache_and_start_app(
// Application will need to do Cache_Flush(1) and Cache_Read_Enable(1)
ESP_LOGD(TAG, "start: 0x%08x", entry_addr);
bootloader_atexit();
typedef void (*entry_t)(void) __attribute__((noreturn));
entry_t entry = ((entry_t) entry_addr);
@@ -768,8 +770,7 @@ static void set_cache_and_start_app(
void bootloader_reset(void)
{
#ifdef BOOTLOADER_BUILD
uart_tx_flush(0); /* Ensure any buffered log output is displayed */
uart_tx_flush(1);
bootloader_atexit();
ets_delay_us(1000); /* Allow last byte to leave FIFO */
REG_WRITE(RTC_CNTL_OPTIONS0_REG, RTC_CNTL_SW_SYS_RST);
while (1) { } /* This line will never be reached, used to keep gcc happy */
@@ -778,6 +779,11 @@ void bootloader_reset(void)
#endif
}
void bootloader_atexit(void)
{
bootloader_console_deinit();
}
esp_err_t bootloader_sha256_hex_to_str(char *out_str, const uint8_t *in_array_hex, size_t len)
{
if (out_str == NULL || in_array_hex == NULL || len == 0) {