main.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /* main.c
  2. *
  3. * Copyright (C) 2006-2022 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. int32_t retv;
  48. retv = finit ("M0:");
  49. if (retv == 0) {
  50. retv = fmount ("M0:");
  51. if (retv == 0) {
  52. printf ("Drive M0 ready!\n");
  53. }
  54. else {
  55. printf ("Drive M0 mount failed!\n");
  56. }
  57. }
  58. else {
  59. printf ("Drive M0 initialization failed!\n");
  60. }
  61. }
  62. #endif
  63. typedef struct func_args {
  64. int argc;
  65. char** argv;
  66. } func_args;
  67. extern void shell_main(func_args * args) ;
  68. /*-----------------------------------------------------------------------------
  69. * mian entry
  70. *----------------------------------------------------------------------------*/
  71. int myoptind = 0;
  72. char* myoptarg = NULL;
  73. int main()
  74. {
  75. void *arg = NULL ;
  76. SystemClock_Config() ;
  77. #if !defined(NO_FILESYSTEM)
  78. init_filesystem ();
  79. #endif
  80. netInitialize() ;
  81. osDelay(300) ;
  82. #if defined(DEBUG_WOLFSSL)
  83. printf("Turning ON Debug message\n") ;
  84. wolfSSL_Debugging_ON() ;
  85. #endif
  86. shell_main(arg) ;
  87. }