lwipopts.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. /* USER CODE BEGIN Header */
  2. /**
  3. ******************************************************************************
  4. * File Name : Target/lwipopts.h
  5. * Description : This file overrides LwIP stack default configuration
  6. * done in opt.h file.
  7. ******************************************************************************
  8. * @attention
  9. *
  10. * Copyright (c) 2022 STMicroelectronics.
  11. * All rights reserved.
  12. *
  13. * This software is licensed under terms that can be found in the LICENSE file
  14. * in the root directory of this software component.
  15. * If no LICENSE file comes with this software, it is provided AS-IS.
  16. *
  17. ******************************************************************************
  18. */
  19. /* USER CODE END Header */
  20. /* Define to prevent recursive inclusion --------------------------------------*/
  21. #ifndef __LWIPOPTS__H__
  22. #define __LWIPOPTS__H__
  23. #include "main.h"
  24. /*-----------------------------------------------------------------------------*/
  25. /* Current version of LwIP supported by CubeMx: 2.1.2 -*/
  26. /*-----------------------------------------------------------------------------*/
  27. /* Within 'USER CODE' section, code will be kept by default at each generation */
  28. /* USER CODE BEGIN 0 */
  29. /* USER CODE END 0 */
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. /* STM32CubeMX Specific Parameters (not defined in opt.h) ---------------------*/
  34. /* Parameters set in STM32CubeMX LwIP Configuration GUI -*/
  35. /*----- WITH_RTOS enabled (Since FREERTOS is set) -----*/
  36. #define WITH_RTOS 1
  37. /*----- CHECKSUM_BY_HARDWARE enabled -----*/
  38. #define CHECKSUM_BY_HARDWARE 1
  39. /*-----------------------------------------------------------------------------*/
  40. /* LwIP Stack Parameters (modified compared to initialization value in opt.h) -*/
  41. /* Parameters set in STM32CubeMX LwIP Configuration GUI -*/
  42. /*----- Default value in ETH configuration GUI in CubeMx: 1524 -----*/
  43. #define ETH_RX_BUFFER_SIZE 1536
  44. /*----- Value in opt.h for MEM_ALIGNMENT: 1 -----*/
  45. #define MEM_ALIGNMENT 4
  46. /*----- Default Value for MEM_SIZE: 1600 ---*/
  47. #define MEM_SIZE 131048
  48. /*----- Default Value for H7 devices: 0x30044000 -----*/
  49. #define LWIP_RAM_HEAP_POINTER 0x30020000
  50. /*----- Value supported for H7 devices: 1 -----*/
  51. #define LWIP_SUPPORT_CUSTOM_PBUF 1
  52. /*----- Value in opt.h for LWIP_ETHERNET: LWIP_ARP || PPPOE_SUPPORT -*/
  53. #define LWIP_ETHERNET 1
  54. /*----- Value in opt.h for LWIP_DNS_SECURE: (LWIP_DNS_SECURE_RAND_XID | LWIP_DNS_SECURE_NO_MULTIPLE_OUTSTANDING | LWIP_DNS_SECURE_RAND_SRC_PORT) -*/
  55. #define LWIP_DNS_SECURE 7
  56. /*----- Default Value for TCP_MSS: 536 ---*/
  57. #define TCP_MSS 1460
  58. /*----- Default Value for TCP_SND_BUF: 2920 ---*/
  59. #define TCP_SND_BUF 5840
  60. /*----- Default Value for TCP_SND_QUEUELEN: 17 ---*/
  61. #define TCP_SND_QUEUELEN 16
  62. /*----- Value in opt.h for LWIP_NETIF_LINK_CALLBACK: 0 -----*/
  63. #define LWIP_NETIF_LINK_CALLBACK 1
  64. /*----- Value in opt.h for TCPIP_THREAD_STACKSIZE: 0 -----*/
  65. #define TCPIP_THREAD_STACKSIZE 2 * 2048
  66. /*----- Value in opt.h for TCPIP_THREAD_PRIO: 1 -----*/
  67. //#define TCPIP_THREAD_PRIO 24
  68. #define TCPIP_THREAD_PRIO 48
  69. /*----- Value in opt.h for TCPIP_MBOX_SIZE: 0 -----*/
  70. #define TCPIP_MBOX_SIZE 6
  71. /*----- Value in opt.h for SLIPIF_THREAD_STACKSIZE: 0 -----*/
  72. #define SLIPIF_THREAD_STACKSIZE 1024
  73. /*----- Value in opt.h for SLIPIF_THREAD_PRIO: 1 -----*/
  74. #define SLIPIF_THREAD_PRIO 3
  75. /*----- Value in opt.h for DEFAULT_THREAD_STACKSIZE: 0 -----*/
  76. #define DEFAULT_THREAD_STACKSIZE 2048
  77. /*----- Value in opt.h for DEFAULT_THREAD_PRIO: 1 -----*/
  78. #define DEFAULT_THREAD_PRIO 3
  79. /*----- Value in opt.h for DEFAULT_UDP_RECVMBOX_SIZE: 0 -----*/
  80. #define DEFAULT_UDP_RECVMBOX_SIZE 6
  81. /*----- Value in opt.h for DEFAULT_TCP_RECVMBOX_SIZE: 0 -----*/
  82. #define DEFAULT_TCP_RECVMBOX_SIZE 6
  83. /*----- Value in opt.h for DEFAULT_ACCEPTMBOX_SIZE: 0 -----*/
  84. #define DEFAULT_ACCEPTMBOX_SIZE 6
  85. /*----- Value in opt.h for RECV_BUFSIZE_DEFAULT: INT_MAX -----*/
  86. #define RECV_BUFSIZE_DEFAULT 2000000000
  87. /*----- Value in opt.h for LWIP_STATS: 1 -----*/
  88. #define LWIP_STATS 0
  89. /*----- Value in opt.h for CHECKSUM_GEN_IP: 1 -----*/
  90. #define CHECKSUM_GEN_IP 0
  91. /*----- Value in opt.h for CHECKSUM_GEN_UDP: 1 -----*/
  92. #define CHECKSUM_GEN_UDP 0
  93. /*----- Value in opt.h for CHECKSUM_GEN_TCP: 1 -----*/
  94. #define CHECKSUM_GEN_TCP 0
  95. /*----- Value in opt.h for CHECKSUM_GEN_ICMP6: 1 -----*/
  96. #define CHECKSUM_GEN_ICMP6 0
  97. /*----- Value in opt.h for CHECKSUM_CHECK_IP: 1 -----*/
  98. #define CHECKSUM_CHECK_IP 0
  99. /*----- Value in opt.h for CHECKSUM_CHECK_UDP: 1 -----*/
  100. #define CHECKSUM_CHECK_UDP 0
  101. /*----- Value in opt.h for CHECKSUM_CHECK_TCP: 1 -----*/
  102. #define CHECKSUM_CHECK_TCP 0
  103. /*----- Value in opt.h for CHECKSUM_CHECK_ICMP6: 1 -----*/
  104. #define CHECKSUM_CHECK_ICMP6 0
  105. /*-----------------------------------------------------------------------------*/
  106. /* USER CODE BEGIN 1 */
  107. #define LWIP_DHCP 1
  108. #define LWIP_NETCONN 1
  109. #define LWIP_TCP 1
  110. #define LWIP_SO_RCVTIMEO 1
  111. #define LWIP_SO_RCVBUF 1
  112. //#define MEMP_NUM_SYS_TIMEOUT 8
  113. //#define TCP_SNDLOWAT 1071
  114. //#define TCP_SNDQUEUELOWAT 5
  115. //#define TCP_WND_UPDATE_THRESHOLD 536
  116. //#define MEMP_NUM_NETCONN 8
  117. //#define MEMP_NUM_NETBUF 4
  118. //#define LWIP_ALTCP 1
  119. //#define LWIP_TCPIP_CORE_LOCKING 1
  120. #define LWIP_DEBUG 0
  121. #define NETIF_DEBUG LWIP_DBG_OFF
  122. #define DHCP_DEBUG LWIP_DBG_OFF
  123. #define UDP_DEBUG LWIP_DBG_OFF
  124. #define TCP_DEBUG LWIP_DBG_OFF
  125. #define MEMP_DEBUG LWIP_DBG_OFF
  126. #define MEM_DEBUG LWIP_DBG_OFF
  127. #define ICMP_DEBUG LWIP_DBG_OFF
  128. #define MQTT_DEBUG LWIP_DBG_OFF
  129. #define API_LIB_DEBUG LWIP_DBG_OFF
  130. /* ETH_CODE: first 2 macros solve errno issue with GCC 10 and ST LwIP
  131. * LWIPERF_CHECK_RX_DATA enables data check for iperf. Removing it might improve performance.
  132. */
  133. #undef LWIP_PROVIDE_ERRNO
  134. #define LWIP_ERRNO_STDINCLUDE
  135. #define LWIPERF_CHECK_RX_DATA 1
  136. /* ETH_CODE: macro and prototypes for proper (hopefuly?)
  137. * multithreading support
  138. */
  139. #define LOCK_TCPIP_CORE sys_lock_tcpip_core
  140. #define UNLOCK_TCPIP_CORE sys_unlock_tcpip_core
  141. #define LWIP_ASSERT_CORE_LOCKED sys_check_core_locking
  142. #define LWIP_MARK_TCPIP_THREAD sys_mark_tcpip_thread
  143. void sys_lock_tcpip_core(void);
  144. void sys_unlock_tcpip_core(void);
  145. void sys_check_core_locking(void);
  146. void sys_mark_tcpip_thread(void);
  147. /* USER CODE END 1 */
  148. #ifdef __cplusplus
  149. }
  150. #endif
  151. #endif /*__LWIPOPTS__H__ */