main.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. #ifdef HAVE_CONFIG_H
  22. #include <config.h>
  23. #endif
  24. #include <wolfssl/wolfcrypt/settings.h>
  25. #include <wolfssl/wolfcrypt/visibility.h>
  26. #include <wolfssl/wolfcrypt/logging.h>
  27. #define __CORTEX_M3__
  28. #include <wolfssl/wolfcrypt/types.h>
  29. #include "wolfcrypt/src/misc.c"
  30. #include "stm32f2xx_hal.h"
  31. #include "cmsis_os.h"
  32. #include "rl_net.h"
  33. #include <stdio.h>
  34. #include <wolfssl/ssl.h>
  35. /*-----------------------------------------------------------------------------
  36. * Initialize Clock Configuration
  37. *----------------------------------------------------------------------------*/
  38. void SystemClock_Config(void) {
  39. #warning "write MPU specific System Clock Set up\n"
  40. }
  41. /*-----------------------------------------------------------------------------
  42. * Initialize a Flash Memory Card
  43. *----------------------------------------------------------------------------*/
  44. #if !defined(NO_FILESYSTEM)
  45. #include "rl_fs.h"
  46. static void init_filesystem(void)
  47. {
  48. int32_t retv;
  49. retv = finit ("M0:");
  50. if (retv == fsOK) {
  51. retv = fmount ("M0:");
  52. if (retv == fsOK) {
  53. printf ("Drive M0 ready!\n");
  54. }
  55. else {
  56. printf ("Drive M0 mount failed(%d)!\n", retv);
  57. }
  58. }
  59. else {
  60. printf ("Drive M0 initialization failed!\n");
  61. }
  62. }
  63. #endif
  64. typedef struct func_args {
  65. int argc;
  66. char** argv;
  67. } func_args;
  68. extern void shell_main(func_args * args);
  69. /*-----------------------------------------------------------------------------
  70. * main entry
  71. *----------------------------------------------------------------------------*/
  72. int myoptind = 0;
  73. char* myoptarg = NULL;
  74. int main()
  75. {
  76. void *arg = NULL;
  77. SystemClock_Config();
  78. #if !defined(NO_FILESYSTEM)
  79. init_filesystem ();
  80. #endif
  81. netInitialize();
  82. osDelay(300);
  83. #if defined(DEBUG_WOLFSSL)
  84. printf("Turning ON Debug message\n");
  85. wolfSSL_Debugging_ON();
  86. #endif
  87. shell_main(arg);
  88. }