esp_rom_sys.c 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * SPDX-FileCopyrightText: 2010-2022 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #include <stdint.h>
  7. #include <stdbool.h>
  8. #include "esp_attr.h"
  9. #include "sdkconfig.h"
  10. IRAM_ATTR void esp_rom_install_channel_putc(int channel, void (*putc)(char c))
  11. {
  12. extern void ets_install_putc1(void (*p)(char c));
  13. extern void ets_install_putc2(void (*p)(char c));
  14. switch (channel) {
  15. case 1:
  16. ets_install_putc1(putc);
  17. break;
  18. case 2:
  19. ets_install_putc2(putc);
  20. break;
  21. default:
  22. break;
  23. }
  24. }
  25. #if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32C2
  26. IRAM_ATTR void esp_rom_install_uart_printf(void)
  27. {
  28. extern void ets_install_uart_printf(void);
  29. extern bool g_uart_print;
  30. // If ROM log is disabled permanently via eFuse or temporarily via RTC storage register,
  31. // this ROM symbol will be set to false, and cause ``esp_rom_printf`` can't work on esp-idf side.
  32. g_uart_print = true;
  33. ets_install_uart_printf();
  34. }
  35. #endif