在rtconfig.h中,功能的宏定义为什么没有使用嵌套呢?这是采用什么样的思路?
譬如lwip,如果要这个模块,那么就要定义#define RT_USING_LWIP
而下面的这些:
/* Trace LwIP protocol */
/* #define RT_LWIP_DEBUG */
/* LwIP uses RT-Thread Memory Management */
#define RT_LWIP_USING_RT_MEM
/* Enable ICMP protocol */
#define RT_LWIP_ICMP
/* Enable IGMP protocol */
/* #define RT_LWIP_IGMP */
/* Enable UDP protocol */
#define RT_LWIP_UDP
/* Enable TCP protocol */
#define RT_LWIP_TCP
/* the number of simulatenously active TCP connections */
#define RT_LWIP_TCP_PCB_NUM 3
/* TCP sender buffer space */
#define RT_LWIP_TCP_SND_BUF 2048
/* TCP Window Size */
#define RT_LWIP_TCP_WND (1024 * 20)
/* Enable SNMP protocol */
/* #define RT_LWIP_SNMP */
/* Using DHCP */
#define RT_LWIP_DHCP
/* Using DNS */
#define RT_LWIP_DNS
/* ip address of target */
#define RT_LWIP_IPADDR0 192
#define RT_LWIP_IPADDR1 168
#define RT_LWIP_IPADDR2 1
#define RT_LWIP_IPADDR3 30
/* gateway address of target */
#define RT_LWIP_GWADDR0 192
#define RT_LWIP_GWADDR1 168
#define RT_LWIP_GWADDR2 1
#define RT_LWIP_GWADDR3 1
/* mask address of target */
#define RT_LWIP_MSKADDR0 255
#define RT_LWIP_MSKADDR1 255
#define RT_LWIP_MSKADDR2 255
#define RT_LWIP_MSKADDR3 0
/* tcp thread options */
#define RT_LWIP_TCPTHREAD_PRIORITY 10
#define RT_LWIP_TCPTHREAD_MBOX_SIZE 4
#define RT_LWIP_TCPTHREAD_STACKSIZE 1024
/* ethernet if thread options */
#define RT_LWIP_ETHTHREAD_PRIORITY 12
#define RT_LWIP_ETHTHREAD_MBOX_SIZE 4
#define RT_LWIP_ETHTHREAD_STACKSIZE 512
应该是要嵌套在定义了 #define RT_USING_LWIP 的前提下才存在的吧?
那么结构应该是:
#define RT_USING_LWIP
#ifdef RT_USING_LWIP
/* Trace LwIP protocol */
/* #define RT_LWIP_DEBUG */
/* LwIP uses RT-Thread Memory Management */
#define RT_LWIP_USING_RT_MEM
/* Enable ICMP protocol */
#define RT_LWIP_ICMP
……
……
#endif
为什么RT-Thread没有采用这样的结构呢?这里有什么技巧吗? 不需要啥技巧:-)
如果不定义RT_USING_LWIP自动不使能整个lwip,这点在scons编译中体现更明显。 哦~~
刚刚看了一下源代码
原来是在源代码里面嵌套了
在源代码中是这样的结构:
#ifdef RT_USING_LWIP
#ifdef RT_LWIP_USING_RT_MEM
……
……
#endif
#endif
呵呵……我觉得在rtconfig.h上定义嵌套会方便一些吧?
页:
[1]