完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
|
操作系统 RTT 4.1.1 芯片STM32F429 编译器 KEIL AC6 -O0 使用list_fd命令,导致看门狗复位 debug查看进入printf就挂了
注释 rt_enter_critical和rt_exit_critical就可以打印
rt_enter_critical和rt_exit_critical这两函数有啥用?
|
|
相关推荐
3个回答
|
|
|
这有点类似telnet里面调用netstat了,需要改进下,应该是同类问题。
|
|
|
|
|
|
|
|
|
|
|
|
我照着改了一下代码,不过我打印出来永远都是空的。不知道这个函数声明用途。 你看一下有没有什么问题?没有我提交一个pr上去
int list_fd(void) { int index; struct dfs_fdtable *fd_table; char *buff = rt_malloc(1024); char *buff_start = buff; fd_table = dfs_fdtable_get(); if (!fd_table) return -1; rt_enter_critical(); buff += rt_sprintf(buff, "fd type ref magic pathn"); buff += rt_sprintf(buff, "-- ------ --- ----- ------n"); for (index = 0; index < (int)fd_table->maxfd; index ++) { struct dfs_fd *fd = fd_table->fds[index]; if (fd && fd->fops) { buff += rt_sprintf(buff,"%2d ", index + DFS_FD_OFFSET); if (fd->type == FT_DIRECTORY) buff += rt_sprintf(buff,"%-7.7s ", "dir"); else if (fd->type == FT_REGULAR) buff += rt_sprintf(buff,"%-7.7s ", "file"); else if (fd->type == FT_SOCKET) buff += rt_sprintf(buff,"%-7.7s ", "socket"); else if (fd->type == FT_USER) buff += rt_sprintf(buff,"%-7.7s ", "user"); else if (fd->type == FT_DEVICE) buff += rt_sprintf(buff,"%-7.7s ", "device"); else rt_kprintf("%-8.8s ", "unknown"); buff += rt_sprintf(buff,"%3d ", fd->ref_count); buff += rt_sprintf(buff,"%04x ", fd->magic); if (fd->fs && fd->fs->path && rt_strlen(fd->fs->path) > 1) { buff += rt_sprintf(buff,"%s", fd->fs->path); } if (fd->path) { buff += rt_sprintf(buff,"%sn", fd->path); } else { buff += rt_sprintf(buff,"n"); } } } rt_exit_critical(); rt_kprintf(buff_start); return 0; } MSH_CMD_EXPORT(list_fd, list file descriptor); |
|
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
1033 浏览 0 评论
2877 浏览 0 评论
图腾柱PFC无法上升至400V,且电感电流为正弦波形,但是幅值极小
9386 浏览 0 评论
飞凌嵌入式ElfBoard-Vim编辑器之静态链接和动态链接
2898 浏览 0 评论
使用 LinkBoy 将程序导出为 C 语言代码并烧录至 Arduino ESP32 开发板
2302 浏览 1 评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-1 22:47 , Processed in 0.667528 second(s), Total 78, Slave 59 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
4466