这个东西做了两天,第一天改底层接口,编译通过。
第二天调通整个程序。
这里难点在于对LwIP不熟悉,在STM32上开发,居然也没有ULINK,连烧程序都是要用串口的。
如果有朋友有需要,我可以给出几个比较关键的东西,不过也说明一下我的开发环境,我是基于神州4号开发板,用keil开发的。
1. UDP客户端/服务器端代码。
main函数:
int main(void)
{
struct udp_pcb *Udppcb_svr = NULL;
struct ip_addr dAddr;
struct pbuf *p = NULL;
int ret = 0;
System_Setup();
/* Initilaize the LwIP satck */
LwIP_Init();
p = pbuf_alloc(PBUF_TRANSPORT, sizeof(UDPArr), PBUF_RAM);
if (p == NULL)
{
printf("no memory for p \r\n");
}
p->payload = (void *)(UDPArr); // 全局变量,只是一个hello字符串。
while (1)
{