main.c 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /* main.c
  2. *
  3. * Copyright (C) 2006-2024 wolfSSL Inc.
  4. *
  5. * This file is part of wolfSSL.
  6. *
  7. * wolfSSL is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * wolfSSL is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
  20. */
  21. /* Espressif */
  22. #include <esp_log.h>
  23. /* wolfSSL */
  24. /* Always include wolfcrypt/settings.h before any other wolfSSL file. */
  25. /* Reminder: settings.h pulls in user_settings.h; don't include it here. */
  26. #ifdef WOLFSSL_USER_SETTINGS
  27. #include <wolfssl/wolfcrypt/settings.h>
  28. #ifndef WOLFSSL_ESPIDF
  29. #warning "Problem with wolfSSL user_settings."
  30. #warning "Check components/wolfssl/include"
  31. #endif
  32. #include <wolfssl/wolfcrypt/port/Espressif/esp32-crypt.h>
  33. #else
  34. /* Define WOLFSSL_USER_SETTINGS project wide for settings.h to include */
  35. /* wolfSSL user settings in ./components/wolfssl/include/user_settings.h */
  36. #error "Missing WOLFSSL_USER_SETTINGS in CMakeLists or Makefile:\
  37. CFLAGS +=-DWOLFSSL_USER_SETTINGS"
  38. #endif
  39. /* project */
  40. #include "main.h"
  41. static const char* const TAG = "My Project";
  42. void app_main(void)
  43. {
  44. #ifdef WOLFSSL_ESPIDF_VERBOSE_EXIT_MESSAGE
  45. int ret = 0;
  46. #endif
  47. ESP_LOGI(TAG, "Hello wolfSSL!");
  48. #ifdef HAVE_VERSION_EXTENDED_INFO
  49. ret = esp_ShowExtendedSystemInfo();
  50. #endif
  51. #if defined(WOLFSSL_HW_METRICS) && defined(WOLFSSL_HAS_METRICS)
  52. ret += esp_hw_show_metrics();
  53. #endif
  54. #ifdef WOLFSSL_ESPIDF_VERBOSE_EXIT_MESSAGE
  55. if (ret == 0) {
  56. ESP_LOGI(TAG, WOLFSSL_ESPIDF_VERBOSE_EXIT_MESSAGE("Success!", ret));
  57. }
  58. else {
  59. ESP_LOGE(TAG, WOLFSSL_ESPIDF_VERBOSE_EXIT_MESSAGE("Failed!", ret));
  60. }
  61. #elif defined(WOLFSSL_ESPIDF_EXIT_MESSAGE)
  62. ESP_LOGI(TAG, WOLFSSL_ESPIDF_EXIT_MESSAGE);
  63. #else
  64. ESP_LOGI(TAG, "\n\nDone!"
  65. "If running from idf.py monitor, press twice: Ctrl+]\n\n"
  66. "WOLFSSL_COMPLETE\n" /* exit keyword for wolfssl_monitor.py */
  67. );
  68. #endif
  69. }