1 // Copyright 2018 Espressif Systems (Shanghai) PTE LTD 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 #pragma once 15 16 #include "esp_err.h" 17 #include "esp_image_format.h" 18 19 /**@{*/ 20 /** 21 * @brief labels from bootloader linker script: bootloader.ld 22 * 23 */ 24 extern int _bss_start; 25 extern int _bss_end; 26 extern int _data_start; 27 extern int _data_end; 28 /**@}*/ 29 30 /** 31 * @brief bootloader image header 32 * 33 */ 34 extern esp_image_header_t bootloader_image_hdr; 35 36 /**@{*/ 37 /** 38 * @brief Common initialization steps that are applied to all targets. 39 * 40 */ 41 esp_err_t bootloader_read_bootloader_header(void); 42 esp_err_t bootloader_check_bootloader_validity(void); 43 void bootloader_clear_bss_section(void); 44 void bootloader_config_wdt(void); 45 void bootloader_enable_random(void); 46 void bootloader_print_banner(void); 47 /**@}*/ 48 49 /* @brief Prepares hardware for work. 50 * 51 * Setting up: 52 * - Disable Cache access for both CPUs; 53 * - Initialise cache mmu; 54 * - Setting up pins and mode for SD, SPI, UART, Clocking. 55 56 * @return ESP_OK - If the setting is successful. 57 * ESP_FAIL - If the setting is not successful. 58 */ 59 esp_err_t bootloader_init(void); 60