应用层代码从RT-thread studio 平台移植过来的,在使用socket 方式,aic 这个平台有点奇怪,又单独弄了个packages\third-party\lwip
这里面没有相关使用sal的配置,跑到原rt-thread components 下 打开
select RT_USING_POSIX_SOCKET
select RT_USING_POSIX_SELECT
select RT_USING_SAL
select RT_USING_POSIX_POLL
编译能够通过,有比较多的警告,运行时候错误
01-01 09:34:05 E/sal.skt: not find network interface device by protocol family(2).
01-01 09:34:05 E/sal.skt: SAL socket protocol family input failed, return error -3.
socket() failed: Not supported
离线
在函数 struct netdev *netdev_get_by_family(int family)中
if (netdev_list == RT_NULL)
{
LOG_E("NULL netdev_list"); // 新增添
return RT_NULL;
}
然后
01-01 17:12:03 E/netdev: NULL netdev_list
01-01 17:12:03 E/sal.skt: not find network interface device by protocol family(2).
01-01 17:12:03 E/sal.skt: SAL socket protocol family input failed, return error -3.
网络是正常的,可以ping通。
离线
Rt-Thread options → RT-Thread Components → Network
LwIP: light weight TCP/IP stack ---- 这个是没有选中,
选中的是 Local packages options → Third-party packages options 里面的
LwIP: light weight TCP/IP stack --->
网络相关配置是参考sdk 文档里面 rtos 相关的配置方式,是可以ping通的
离线
static err_t eth_netif_device_init(struct netif *netif) 函数里面会调用 netdev_add(netif);将netif 插入到netdev_list 中,于是在里面插入了一条打印信息
static err_t eth_netif_device_init(struct netif *netif)
{
struct eth_device *ethif;
ethif = (struct eth_device*)netif->state;
LOG_I("eth_netif_device_init:netif=0x%08x", netif);//插入打印信息
if (ethif != RT_NULL)
{
rt_device_t device;
#ifdef RT_USING_NETDEV
/* network interface device register */
netdev_add(netif);
#endif /* RT_USING_NETDEV */
程序更新后发现并没有打印出来,说明这个函数没有被调用。
发现这个依赖于RT_USING_LWIP,查找kconfig 发现要选中Rt-Thread options → RT-Thread Components → Network
LwIP: light weight TCP/IP stack ---- 这里的配置。
现在要重新配置了,感觉太乱了,自己非得要再加一个另外的lwip 功能还支持不全!
离线
启用rt-thread 那个lwip 后直接ping不通了
pri status sp stack size max used left tick error
---------------- --- ------- ---------- ---------- ------ ---------- ---
touch 25 suspend 0x0000029c 0x00001000 26% 0x00000004 OK
tx_serial 25 suspend 0x000002a4 0x00000800 49% 0x00000008 OK
rx_serial 25 suspend 0x00000334 0x00000800 40% 0x0000000a OK
LVGL 20 ready 0x00000250 0x00008000 10% 0xfffffec8 ETIMOUT
tshell 20 running 0x000005a8 0x00001000 35% 0x00000008 OK
usbh_hub0 0 suspend 0x00000360 0x00001000 22% 0x00000009 OK
mmcsd_detect 22 suspend 0x000002e0 0x00002000 37% 0x00000011 OK
alarmsvc 10 suspend 0x00000284 0x00000800 31% 0x00000005 OK
sys workq 23 suspend 0x00000234 0x00000800 27% 0x0000000a OK
tcpip 10 suspend 0x000002f4 0x00000800 36% 0x00000014 OK
etx 12 suspend 0x00000290 0x00000800 32% 0x00000010 OK
erx 12 suspend 0x000002c8 0x00000800 34% 0x00000010 OK
tidle0 31 ready 0x00000248 0x00000400 61% 0x00000018 OK
aic /> ifconfig
ifconfig: network interface device list error.
aic />
最近编辑记录 pineyer (2025-01-24 18:29:56)
离线