1 /*
2  * SPDX-FileCopyrightText: 2018-2021 Espressif Systems (Shanghai) CO LTD
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 #pragma once
7 
8 #include "esp_err.h"
9 #include "esp_image_format.h"
10 
11 /**@{*/
12 /**
13  * @brief labels from bootloader linker script: bootloader.ld
14  *
15  */
16 extern int _bss_start[];
17 extern int _bss_end[];
18 extern int _data_start[];
19 extern int _data_end[];
20 /**@}*/
21 
22 /**
23  * @brief bootloader image header
24  *
25  */
26 extern esp_image_header_t bootloader_image_hdr;
27 
28 /**@{*/
29 /**
30  * @brief Common initialization steps that are applied to all targets.
31  *
32  */
33 esp_err_t bootloader_read_bootloader_header(void);
34 esp_err_t bootloader_check_bootloader_validity(void);
35 void bootloader_clear_bss_section(void);
36 void bootloader_config_wdt(void);
37 void bootloader_enable_random(void);
38 void bootloader_print_banner(void);
39 /**@}*/
40 
41 /* @brief Prepares hardware for work.
42  *
43  * Setting up:
44  * - Disable Cache access for both CPUs;
45  * - Initialise cache mmu;
46  * - Setting up pins and mode for SD, SPI, UART, Clocking.
47 
48  *  @return ESP_OK   - If the setting is successful.
49  *          ESP_FAIL - If the setting is not successful.
50  */
51 esp_err_t bootloader_init(void);
52