lwipopts.h 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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) 2024 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. /* Temporary workaround to avoid conflict on errno defined in STM32CubeIDE and lwip sys_arch.c errno */
  38. #undef LWIP_PROVIDE_ERRNO
  39. /*----- CHECKSUM_BY_HARDWARE enabled -----*/
  40. #define CHECKSUM_BY_HARDWARE 1
  41. /*-----------------------------------------------------------------------------*/
  42. /* LwIP Stack Parameters (modified compared to initialization value in opt.h) -*/
  43. /* Parameters set in STM32CubeMX LwIP Configuration GUI -*/
  44. /*----- Value in opt.h for LWIP_DHCP: 0 -----*/
  45. #define LWIP_DHCP 1
  46. /*----- Default value in ETH configuration GUI in CubeMx: 1524 -----*/
  47. #define ETH_RX_BUFFER_SIZE 1536
  48. /*----- Value in opt.h for MEM_ALIGNMENT: 1 -----*/
  49. #define MEM_ALIGNMENT 4
  50. /*----- Default Value for MEM_SIZE: 1600 ---*/
  51. #define MEM_SIZE 131048
  52. /*----- Default Value for H7 devices: 0x30044000 -----*/
  53. #define LWIP_RAM_HEAP_POINTER 0x24020000
  54. /*----- Value in opt.h for MEMP_NUM_SYS_TIMEOUT: (LWIP_TCP + IP_REASSEMBLY + LWIP_ARP + (2*LWIP_DHCP) + LWIP_AUTOIP + LWIP_IGMP + LWIP_DNS + (PPP_SUPPORT*6*MEMP_NUM_PPP_PCB) + (LWIP_IPV6 ? (1 + LWIP_IPV6_REASS + LWIP_IPV6_MLD) : 0)) -*/
  55. #define MEMP_NUM_SYS_TIMEOUT 5
  56. /*----- Value supported for H7 devices: 1 -----*/
  57. #define LWIP_SUPPORT_CUSTOM_PBUF 1
  58. /*----- Value in opt.h for LWIP_ETHERNET: LWIP_ARP || PPPOE_SUPPORT -*/
  59. #define LWIP_ETHERNET 1
  60. /*----- 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) -*/
  61. #define LWIP_DNS_SECURE 7
  62. /*----- Default Value for TCP_MSS: 536 ---*/
  63. #define TCP_MSS 1460
  64. /*----- Default Value for TCP_SND_BUF: 2920 ---*/
  65. #define TCP_SND_BUF 5840
  66. /*----- Default Value for TCP_SND_QUEUELEN: 17 ---*/
  67. #define TCP_SND_QUEUELEN 16
  68. /*----- Value in opt.h for LWIP_NETIF_LINK_CALLBACK: 0 -----*/
  69. #define LWIP_NETIF_LINK_CALLBACK 1
  70. /*----- Value in opt.h for TCPIP_THREAD_STACKSIZE: 0 -----*/
  71. #define TCPIP_THREAD_STACKSIZE 2 * 2048
  72. /*----- Value in opt.h for TCPIP_THREAD_PRIO: 1 -----*/
  73. //#define TCPIP_THREAD_PRIO 24
  74. #define TCPIP_THREAD_PRIO 48
  75. /*----- Value in opt.h for TCPIP_MBOX_SIZE: 0 -----*/
  76. #define TCPIP_MBOX_SIZE 6
  77. /*----- Value in opt.h for SLIPIF_THREAD_STACKSIZE: 0 -----*/
  78. #define SLIPIF_THREAD_STACKSIZE 1024
  79. /*----- Value in opt.h for SLIPIF_THREAD_PRIO: 1 -----*/
  80. #define SLIPIF_THREAD_PRIO 3
  81. /*----- Value in opt.h for DEFAULT_THREAD_STACKSIZE: 0 -----*/
  82. #define DEFAULT_THREAD_STACKSIZE 2048
  83. /*----- Value in opt.h for DEFAULT_THREAD_PRIO: 1 -----*/
  84. #define DEFAULT_THREAD_PRIO 3
  85. /*----- Value in opt.h for DEFAULT_UDP_RECVMBOX_SIZE: 0 -----*/
  86. #define DEFAULT_UDP_RECVMBOX_SIZE 6
  87. /*----- Value in opt.h for DEFAULT_TCP_RECVMBOX_SIZE: 0 -----*/
  88. #define DEFAULT_TCP_RECVMBOX_SIZE 6
  89. /*----- Value in opt.h for DEFAULT_ACCEPTMBOX_SIZE: 0 -----*/
  90. #define DEFAULT_ACCEPTMBOX_SIZE 6
  91. /*----- Value in opt.h for RECV_BUFSIZE_DEFAULT: INT_MAX -----*/
  92. #define RECV_BUFSIZE_DEFAULT 2000000000
  93. /*----- Value in opt.h for LWIP_STATS: 1 -----*/
  94. #define LWIP_STATS 0
  95. /*----- Value in opt.h for CHECKSUM_GEN_IP: 1 -----*/
  96. #define CHECKSUM_GEN_IP 0
  97. /*----- Value in opt.h for CHECKSUM_GEN_UDP: 1 -----*/
  98. #define CHECKSUM_GEN_UDP 0
  99. /*----- Value in opt.h for CHECKSUM_GEN_TCP: 1 -----*/
  100. #define CHECKSUM_GEN_TCP 0
  101. /*----- Value in opt.h for CHECKSUM_GEN_ICMP6: 1 -----*/
  102. #define CHECKSUM_GEN_ICMP6 0
  103. /*----- Value in opt.h for CHECKSUM_CHECK_IP: 1 -----*/
  104. #define CHECKSUM_CHECK_IP 0
  105. /*----- Value in opt.h for CHECKSUM_CHECK_UDP: 1 -----*/
  106. #define CHECKSUM_CHECK_UDP 0
  107. /*----- Value in opt.h for CHECKSUM_CHECK_TCP: 1 -----*/
  108. #define CHECKSUM_CHECK_TCP 0
  109. /*----- Value in opt.h for CHECKSUM_CHECK_ICMP6: 1 -----*/
  110. #define CHECKSUM_CHECK_ICMP6 0
  111. /*-----------------------------------------------------------------------------*/
  112. /* USER CODE BEGIN 1 */
  113. //#define LWIP_DHCP 1
  114. #define LWIP_NETCONN 1
  115. #define LWIP_TCP 1
  116. #define LWIP_SO_RCVTIMEO 1
  117. #define LWIP_SO_RCVBUF 1
  118. //#define MEMP_NUM_SYS_TIMEOUT 8
  119. //#define TCP_SNDLOWAT 1071
  120. //#define TCP_SNDQUEUELOWAT 5
  121. //#define TCP_WND_UPDATE_THRESHOLD 536
  122. //#define MEMP_NUM_NETCONN 8
  123. //#define MEMP_NUM_NETBUF 4
  124. //#define LWIP_ALTCP 1
  125. //#define LWIP_TCPIP_CORE_LOCKING 1
  126. #define LWIP_DEBUG 0
  127. #define NETIF_DEBUG LWIP_DBG_OFF
  128. #define DHCP_DEBUG LWIP_DBG_OFF
  129. #define UDP_DEBUG LWIP_DBG_OFF
  130. #define TCP_DEBUG LWIP_DBG_OFF
  131. #define MEMP_DEBUG LWIP_DBG_OFF
  132. #define MEM_DEBUG LWIP_DBG_OFF
  133. #define ICMP_DEBUG LWIP_DBG_OFF
  134. #define MQTT_DEBUG LWIP_DBG_OFF
  135. #define API_LIB_DEBUG LWIP_DBG_OFF
  136. /* ETH_CODE: first 2 macros solve errno issue with GCC 10 and ST LwIP
  137. * LWIPERF_CHECK_RX_DATA enables data check for iperf. Removing it might improve performance.
  138. */
  139. #undef LWIP_PROVIDE_ERRNO
  140. #define LWIP_ERRNO_STDINCLUDE
  141. #define LWIPERF_CHECK_RX_DATA 1
  142. /* ETH_CODE: macro and prototypes for proper (hopefuly?)
  143. * multithreading support
  144. */
  145. #define LOCK_TCPIP_CORE sys_lock_tcpip_core
  146. #define UNLOCK_TCPIP_CORE sys_unlock_tcpip_core
  147. #define LWIP_ASSERT_CORE_LOCKED sys_check_core_locking
  148. #define LWIP_MARK_TCPIP_THREAD sys_mark_tcpip_thread
  149. void sys_lock_tcpip_core(void);
  150. void sys_unlock_tcpip_core(void);
  151. void sys_check_core_locking(void);
  152. void sys_mark_tcpip_thread(void);
  153. /* USER CODE END 1 */
  154. #ifdef __cplusplus
  155. }
  156. #endif
  157. #endif /*__LWIPOPTS__H__ */