<font face="Default Sans Serif,Verdana,Arial,Helvetica,sans-serif" size="2">It's just a random string testcase for printf.<div><br></div><div>I know it's not a correct parameter for printf, but this <b><font color="#ff0000">lead to </font></b><span style="font-family: courier, "courier new", monospace; font-size: 14px; white-space: pre-wrap;"><b><font color="#ff0000">uart print space(ascii:0x20)0 forever</font></b>.</span></div><div><span style="font-family: courier, "courier new", monospace; font-size: 14px; white-space: pre-wrap;"><br></span></div><div><span style="font-family: courier, "courier new", monospace; font-size: 14px; white-space: pre-wrap;">Maybe it's a newlib bug.</span><br><br>So, I was wonder who encountered this proble, and how to solve this problem.</div><div><br><font color="#990099">-----groups@chichak.ca 撰写:-----</font><div style="padding-left:5px;"><div style="padding-right:0px;padding-left:5px;border-left:solid black 2px;">收件人: tianye@sugon.com, "RTEMS List" <rtems-users@rtems.org><br>发件人: groups@chichak.ca<br>日期: 2022/12/20 下午01:49<br>主题: Re: Question on rtems printf problem<br><br><!--Notes ACF <meta http-equiv="Content-Type" content="text/html; charset=utf-8">--><!--Notes ACF <meta http-equiv="Content-Type" content="text/html; charset=utf-8" class="">--><div class=""><div dir="auto" class=""><!--Notes ACF <meta http-equiv="Content-Type" content="text/html; charset=utf-8" class="">--><div class=""><div dir="auto" class=""><!--Notes ACF <meta http-equiv="Content-Type" content="text/html; charset=utf-8" class="">--><div class=""><!--Notes ACF <meta http-equiv="Content-Type" content="text/html; charset=utf-8" class="">--><div class="">On 2022-December-19, at 19:59, <a href="mailto:tianye@sugon.com" class="">tianye@sugon.com</a> wrote:<br class=""><div class=""><blockquote type="cite" class=""><br class="Apple-interchange-newline"><div class=""><font face="Default Sans Serif,Verdana,Arial,Helvetica,sans-serif" size="2" class=""><font face="Verdana, Arial, Helvetica, sans-serif" class="">Hi:</font><div style="font-family: Verdana, Arial, Helvetica, sans-serif;" class=""><span style="white-space:pre" class=""> </span><span style="font-family: courier, "courier new", monospace; font-size: 14px; white-space: pre-wrap;" class="">I have a testcode, it will lead to uart print space forever.</span></div><div style="font-family: Verdana, Arial, Helvetica, sans-serif;" class=""><span style="font-family: courier, "courier new", monospace; font-size: 14px; white-space: pre-wrap;" class=""><br class=""></span></div><div style="font-family: Verdana, Arial, Helvetica, sans-serif;" class=""><span style="font-family: courier, "courier new", monospace; font-size: 14px; white-space: pre-wrap;" class="">Demo code like this:</span></div><div style="font-family: Verdana, Arial, Helvetica, sans-serif;" class=""><span style="font-family: courier, "courier new", monospace; font-size: 14px; white-space: pre-wrap;" class=""><span style="white-space:pre" class="">  </span>Init()</span></div><div style="font-family: Verdana, Arial, Helvetica, sans-serif;" class=""><span style="font-family: courier, "courier new", monospace; font-size: 14px; white-space: pre-wrap;" class=""><span style="white-space:pre" class="">    </span>{</span></div><div style="font-family: Verdana, Arial, Helvetica, sans-serif;" class=""><span style="font-family: courier, "courier new", monospace; font-size: 14px; white-space: pre-wrap;" class=""><span style="white-space:pre" class="">         </span>create a task;</span></div><div style="font-family: Verdana, Arial, Helvetica, sans-serif;" class=""><span style="font-family: courier, "courier new", monospace; font-size: 14px; white-space: pre-wrap;" class=""><span style="white-space:pre" class="">            </span>start this task;</span></div><div style="font-family: Verdana, Arial, Helvetica, sans-serif;" class=""><span style="font-family: courier, "courier new", monospace; font-size: 14px; white-space: pre-wrap;" class=""><span style="white-space:pre" class="">          </span><b class="">printf("%*\n");</b></span></div><div style="font-family: Verdana, Arial, Helvetica, sans-serif;" class=""><span style="font-family: courier, "courier new", monospace; font-size: 14px; white-space: pre-wrap;" class="">                while(1) { </span></div><div style="font-family: Verdana, Arial, Helvetica, sans-serif;" class=""><span style="font-family: courier, "courier new", monospace; font-size: 14px; white-space: pre-wrap;" class=""><span style="white-space:pre" class="">                        </span>sleep()</span></div><div style="font-family: Verdana, Arial, Helvetica, sans-serif;" class=""><span style="font-family: courier, "courier new", monospace; font-size: 14px; white-space: pre-wrap;" class=""><span style="white-space:pre" class="">           </span>}</span></div><div style="font-family: Verdana, Arial, Helvetica, sans-serif;" class=""><span style="font-family: courier, "courier new", monospace; font-size: 14px; white-space: pre-wrap;" class=""><span style="white-space:pre" class=""> </span>}</span></div></font></div></blockquote><br class=""></div><div class="">What are you expecting get? The * tells printf that there will be a parameter following that will give you the length of the subsequent parameter. Usually of the format %*s, length, string.</div><div class="">I’m pretty sure that you don’t have a proper format string, it’s missing the item that you should be specifying the length for and then you neither have the length nor the item to be printed.</div><br class=""><div class="">What are you trying to do?</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">A</div><br class=""><br class=""><div class=""> <div class=""><span class="Apple-style-span"><div class=""><span class="Apple-style-span"><div class=""><span class="Apple-style-span"><div class=""><span class="Apple-style-span"><div class=""><span class="Apple-style-span"><div class=""><span class="Apple-style-span"><div class=""><div class="">---------------------</div><div class="">Andrei Chichak</div><div class=""><br class=""></div></div></span></div></span></div></span></div></span></div></span></div></span></div></div></div></div></div></div></div></div></div></div></div><div></div></font>