Printf()停止了串口工作

时间:2013-07-08 16:07:39

标签: c memory embedded

我会在这里走出困境,因为我不确定你需要看什么代码。

我正在研究一些具有串行用户界面的嵌入式代码。当我移动到新的以太网驱动程序时,只有一半用于通过连接发送文本的printf()语句工作,所以我有很多空白命令输出。知道会导致这种情况的任何想法吗?

我在网上看到这个可能与堆栈大小有关吗?

我很乐意发布更多信息,以便在任何需要的地方澄清。

谢谢!

示例1:

// List commands and their summary
// It is assumed that a command with an empty summary does not 
// actually exist (helpful for conditional compilation)
printf( "Shell commands:\n" );   **This line Prints**
while( 1 )
{
  if( ph->cmd == NULL )
    break;
  if( strlen( ph->help_summary ) > 0 )
    printf( "  %-6s - %s\n", ph->cmd, ph->help_summary ); **This does not**
  ph ++;
}
printf( "For more information use 'help <command>'.\n" ); **This line prints**
}

当我单步执行代码时,到达printf()并实际上运行,但没有输出通过串行连接。

回答,懒惰滚动:

我的驱动程序有一些填充了printf()的调试代码,这些代码在发布时没有被注释掉......我已经删除它并且问题已经消失了。不知何故,这必定会在记忆中造成一些问题。

1 个答案:

答案 0 :(得分:0)

我的驱动程序有一些填充了printf()的调试代码,这些代码在发布时没有被注释掉......我已经删除了它,问题就消失了。不知何故,这必定会在记忆中造成一些问题。

相关问题