bootloader_init.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. #include "esp_err.h"
  16. #include "esp_image_format.h"
  17. /**@{*/
  18. /**
  19. * @brief labels from bootloader linker script: bootloader.ld
  20. *
  21. */
  22. extern int _bss_start;
  23. extern int _bss_end;
  24. extern int _data_start;
  25. extern int _data_end;
  26. /**@}*/
  27. /**
  28. * @brief bootloader image header
  29. *
  30. */
  31. extern esp_image_header_t bootloader_image_hdr;
  32. /**@{*/
  33. /**
  34. * @brief Common initialization steps that are applied to all targets.
  35. *
  36. */
  37. esp_err_t bootloader_read_bootloader_header(void);
  38. esp_err_t bootloader_check_bootloader_validity(void);
  39. void bootloader_clear_bss_section(void);
  40. void bootloader_config_wdt(void);
  41. void bootloader_enable_random(void);
  42. void bootloader_print_banner(void);
  43. /**@}*/
  44. /* @brief Prepares hardware for work.
  45. *
  46. * Setting up:
  47. * - Disable Cache access for both CPUs;
  48. * - Initialise cache mmu;
  49. * - Setting up pins and mode for SD, SPI, UART, Clocking.
  50. * @return ESP_OK - If the setting is successful.
  51. * ESP_FAIL - If the setting is not successful.
  52. */
  53. esp_err_t bootloader_init(void);