【微雪 RP2040双核开发板】官方例程运行问题与解决
<div class='showpostmsg'> 本帖最后由 jinyi7016 于 2022-11-25 14:04 编辑<p>一、起因</p>
<p>在ubuntu上搭建好开发环境后,编译了官方的例程,但开发板的硬件与官方开发板的差异还是很大的,虽然编译了例程,但几乎没有可以运行运行的例程,所以,就重新编译了官方提供的例程。</p>
<p>文件是RP2040-LCD-1.28.zip,在ubuntu下进行编译。</p>
<p>但是编译好的文件,烧写到开发板上,运行到Paint_DrawImage后,就不再运行,也无法显示while中的六轴数据。</p>
<p>会卡在如下界面:</p>
<p> </p>
<p></p>
<p> </p>
<p>重新下载官方文件中已经编译好的文件,就可以正常运行,自己编译的就不行。可以确定的是代码没有修改过。</p>
<p>gcc的版本是9.2.1</p>
<p><!--5f39ae17-8c62-4a45-bc43-b32064c9388a:W3siYmxvY2tJZCI6IjQ5ODUtMTY2OTMzNzU5NDU1MSIsImJsb2NrVHlwZSI6InBhcmFncmFwaCIsInN0eWxlcyI6eyJhbGlnbiI6ImxlZnQiLCJpbmRlbnQiOjAsInRleHQtaW5kZW50IjowLCJsaW5lLWhlaWdodCI6MS43NSwiYmFjay1jb2xvciI6IiIsInBhZGRpbmciOiIifSwidHlwZSI6InBhcmFncmFwaCIsInJpY2hUZXh0Ijp7ImRhdGEiOlt7ImNoYXIiOiLkuIAifSx7ImNoYXIiOiLjgIEifSx7ImNoYXIiOiLotbcifSx7ImNoYXIiOiLlm6AifV0sImlzUmljaFRleHQiOnRydWUsImtlZXBMaW5lQnJlYWsiOnRydWV9fSx7ImJsb2NrSWQiOiI1NDM5LTE2NjkzMDY4NTQ2NjIiLCJibG9ja1R5cGUiOiJwYXJhZ3JhcGgiLCJzdHlsZXMiOnsiYWxpZ24iOiJsZWZ0IiwiaW5kZW50IjowLCJ0ZXh0LWluZGVudCI6MCwibGluZS1oZWlnaHQiOjEuNzUsImJhY2stY29sb3IiOiIiLCJwYWRkaW5nIjoiIn0sInR5cGUiOiJwYXJhZ3JhcGgiLCJyaWN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oVGV4dCI6eyJkYXRhIjpbeyJjaGFyIjoiZyJ9LHsiY2hhciI6ImMifSx7ImNoYXIiOiJjIn0seyJjaGFyIjoi55qEIn0seyJjaGFyIjoi54mIIn0seyJjaGFyIjoi5pysIn0seyJjaGFyIjoi5pivIn0seyJjaGFyIjoiOSJ9LHsiY2hhciI6Ii4ifSx7ImNoYXIiOiIyIn0seyJjaGFyIjoiLiJ9LHsiY2hhciI6IjEifV0sImlzUmljaFRleHQiOnRydWUsImtlZXBMaW5lQnJlYWsiOnRydWV9fV0=--></p>
<p> </p>
<p></p>
<p>cmake的版本是3.16.3</p>
<p> </p>
<p><!--5f39ae17-8c62-4a45-bc43-b32064c9388a:W3siYmxvY2tJZCI6IjQyNDUtMTY2OTM0MTQ1MTg5MiIsImJsb2NrVHlwZSI6InBhcmFncmFwaCIsInN0eWxlcyI6eyJhbGlnbiI6ImxlZnQiLCJpbmRlbnQiOjAsInRleHQtaW5kZW50IjowLCJsaW5lLWhlaWdodCI6MS43NSwiYmFjay1jb2xvciI6IiIsInBhZGRpbmciOiIifSwidHlwZSI6InBhcmFncmFwaCIsInJpY2hUZXh0Ijp7ImRhdGEiOlt7ImNoYXIiOiJjIn0seyJjaGFyIjoibSJ9LHsiY2hhciI6ImEifSx7ImNoYXIiOiJrIn0seyJjaGFyIjoiZSJ9LHsiY2hhciI6IueahCJ9LHsiY2hhciI6IueJiCJ9LHsiY2hhciI6IuacrCJ9LHsiY2hhciI6IuaYryJ9LHsiY2hhciI6IjMifSx7ImNoYXIiOiIuIn0seyJjaGFyIjoiMSJ9LHsiY2hhciI6IjYifSx7ImNoYXIiOiIuIn0seyJjaGFyIjoiMyJ9XSwiaXNSaWNoVGV4dCI6dHJ1ZSwia2VlcExpbmVCcmVhayI6dHJ1ZX19XQ==--></p>
<p></p>
<p>猜可能是编译器的问题,知道官方使用的编译环境是哪些版本的。所以,按官方的方法,又在windows下搭建了环境。</p>
<p>重新编译后,一样的结果。</p>
<p>windows的编译时,打开的命令行要是Visual Studio 2019目录下的,运行的命令为:</p>
<p><!--5f39ae17-8c62-4a45-bc43-b32064c9388a:W3siYmxvY2tJZCI6IjE1MTAtMTY2OTM0MTQ1MDU0NyIsImJsb2NrVHlwZSI6InBhcmFncmFwaCIsInN0eWxlcyI6eyJhbGlnbiI6ImxlZnQiLCJpbmRlbnQiOjAsInRleHQtaW5kZW50IjowLCJsaW5lLWhlaWdodCI6MS43NSwiYmFjay1jb2xvciI6IiIsInBhZGRpbmciOiIifSwidHlwZSI6InBhcmFncmFwaCIsInJpY2hUZXh0Ijp7ImRhdGEiOlt7ImNoYXIiOiLnjJwifSx7ImNoYXIiOiLlj68ifSx7ImNoYXIiOiLog70ifSx7ImNoYXIiOiLmmK8ifSx7ImNoYXIiOiLnvJYifSx7ImNoYXIiOiLor5EifSx7ImNoYXIiOiLlmagifSx7ImNoYXIiOiLnmoQifSx7ImNoYXIiOiLpl64ifSx7ImNoYXIiOiLpopgifSx7ImNoYXIiOiLvvIwifSx7ImNoYXIiOiLnn6UifSx7ImNoYXIiOiLpgZMifSx7ImNoYXIiOiLlrpgifSx7ImNoYXIiOiLmlrkifSx7ImNoYXIiOiLkvb8ifSx7ImNoYXIiOiLnlKgifSx7ImNoYXIiOiLnmoQifSx7ImNoYXIiOiLnvJYifSx7ImNoYXIiOiLor5EifSx7ImNoYXIiOiLnjq8ifSx7ImNoYXIiOiLlooMifSx7ImNoYXIiOiLmmK8ifSx7ImNoYXIiOiLlk6oifSx7ImNoYXIiOiLkupsifSx7ImNoYXIiOiLniYgifSx7ImNoYXIiOiLmnKwifSx7ImNoYXIiOiLnmoQifSx7ImNoYXIiOiLjgIIifSx7ImNoYXIiOiLmiYAifSx7ImNoYXIiOiLku6UifSx7ImNoYXIiOiLvvIwifSx7ImNoYXIiOiLmjIkifSx7ImNoYXIiOiLlrpgifSx7ImNoYXIiOiLmlrkifSx7ImNoYXIiOiLnmoQifSx7ImNoYXIiOiLmlrkifSx7ImNoYXIiOiLms5UifSx7ImN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FrIjp0cnVlfX1d--></p>
<pre>
<code>cd E:\workspace_RP2040\pico-sdk-master
mkdir build
cd build
cmake -G "NMake Makefiles" ..
nmake</code></pre>
<p>二、查找</p>
<p>通过逐行的排查,发现是Paint_DrawNum函数导致的,如果在while中调用了Paint_DrawNum函数,程序将会卡住。</p>
<p> </p>
<p>找到该函数的源码如下,就把数字转换成字符串并显示。</p>
<p><!--5f39ae17-8c62-4a45-bc43-b32064c9388a:W3siYmxvY2tJZCI6IjYxNDAtMTY2OTMwNzY0NjE3NSIsImJsb2NrVHlwZSI6InBhcmFncmFwaCIsInN0eWxlcyI6eyJhbGlnbiI6ImxlZnQiLCJpbmRlbnQiOjAsInRleHQtaW5kZW50IjowLCJsaW5lLWhlaWdodCI6MS43NSwiYmFjay1jb2xvciI6IiIsInBhZGRpbmciOiIifSwidHlwZSI6InBhcmFncmFwaCIsInJpY2hUZXh0Ijp7ImRhdGEiOlt7ImNoYXIiOiLkuowifSx7ImNoYXIiOiLjgIEifSx7ImNoYXIiOiLmn6UifSx7ImNoYXIiOiLmib4ifV0sImlzUmljaFRleHQiOnRydWUsImtlZXBMaW5lQnJlYWsiOnRydWV9fSx7ImJsb2NrSWQiOiI2MjIyLTE2NjkzMDc2NDUyNDgiLCJibG9ja1R5cGUiOiJwYXJhZ3JhcGgiLCJzdHlsZXMiOnsiYWxpZ24iOiJsZWZ0IiwiaW5kZW50IjowLCJ0ZXh0LWluZGVudCI6MCwibGluZS1oZWlnaHQiOjEuNzUsImJhY2stY29sb3IiOiIiLCJwYWRkaW5nIjoiIn0sInR5cGUiOiJwYXJhZ3JhcGgiLCJyaWNoVGV4dCI6eyJkYXRhIjpbeyJjaGFyIjoi6YCaIn0seyJjaGFyIjoi6L+HIn0seyJjaGFyIjoi6YCQIn0seyJjaGFyIjoi6KGMIn0seyJjaGFyIjoi55qEIn0seyJjaGFyIjoi5o6SIn0seyJjaGFyIjoi5p+lIn0seyJjaGFyIjoi77yMIn0seyJjaGFyIjoi5Y+RI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YviJ9LHsiY2hhciI6IuekuiJ9LHsiY2hhciI6IuOAgiJ9XSwiaXNSaWNoVGV4dCI6dHJ1ZSwia2VlcExpbmVCcmVhayI6dHJ1ZX19XQ==--></p>
<pre>
<code>#define ARRAY_LEN 255
void Paint_DrawNum(UWORD Xpoint, UWORD Ypoint, double Nummber,
sFONT *Font, UWORD Digit, UWORD Color_Foreground, UWORD Color_Background)
{
char Str;
sprintf(Str, "%.*lf", Digit + 1, Nummber);
char *pStr = (char *)malloc((strlen(Str)) * sizeof(char));
memcpy(pStr, Str, (strlen(Str) - 1));
*(pStr + strlen(Str) - 1) = '\0';
if (Digit == 0)
*(pStr + strlen(Str) - 2) = '\0';
// show
Paint_DrawString_EN(Xpoint, Ypoint, (const char *)pStr, Font, Color_Foreground, Color_Background);
free(pStr);
pStr = NULL;
}</code></pre>
<p>由于在程序开始时,在第一屏的显示上,也调用了这个函数,显示了一个flaot的小数,是可以正常的,说明函数本身应该是没有问题的。</p>
<p>但到while中却显示不正常,确实有一些不解。</p>
<p>唯一不同的,就是字号的不同。初始化进的字号是20,while中的字号是16.所以,把while中的字号修改成20再测试时,也是一样的结果。</p>
<p> </p>
<p> </p>
<p>三、解决</p>
<p> </p>
<p>从Paint_DrawNum的源码上看,逻辑应该是没有问题的,在linux也单独测试了这个函数,也是可以正常输出的,那么问题就可能出在交叉编译时,编译器对这个函数的处理上。</p>
<p>如下,是测试进的程序</p>
<p><!--5f39ae17-8c62-4a45-bc43-b32064c9388a:W3siYmxvY2tJZCI6Ijk0MzItMTY2OTMwNzE4Mzg0NyIsImJsb2NrVHlwZSI6InBhcmFncmFwaCIsInN0eWxlcyI6eyJhbGlnbiI6ImxlZnQiLCJpbmRlbnQiOjAsInRleHQtaW5kZW50IjowLCJsaW5lLWhlaWdodCI6MS43NSwiYmFjay1jb2xvciI6IiIsInBhZGRpbmciOiIifSwidHlwZSI6InBhcmFncmFwaCIsInJpY2hUZXh0Ijp7ImRhdGEiOlt7ImNoYXIiOiLnlL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NSaWNoVGV4dCI6dHJ1ZSwia2VlcExpbmVCcmVhayI6dHJ1ZX19XQ==--></p>
<p> </p>
<p></p>
<p> </p>
<p>整个函数上看,唯一可能有问题的就是malloc与free这些涉及到内存处理的函数了,所以,把这个函数修改成如下</p>
<p><!--5f39ae17-8c62-4a45-bc43-b32064c9388a:W3siYmxvY2tJZCI6IjIwMzYtMTY2OTM0MjY1Mjg0NCIsImJsb2NrVHlwZSI6InBhcmFncmFwaCIsInN0eWxlcyI6eyJhbGlnbiI6ImxlZnQiLCJpbmRlbnQiOjAsInRleHQtaW5kZW50IjowLCJsaW5lLWhlaWdodCI6MS43NSwiYmFjay1jb2xvciI6IiIsInBhZGRpbmciOiIifSwidHlwZSI6InBhcmFncmFwaCIsInJpY2hUZXh0Ijp7ImRhdGEiOlt7ImNoYXIiOiLmlbQifSx7ImNoYXIiOiLkuKoifSx7ImNoYXIiOiLlh70ifSx7ImNoYXIiOiLmlbAifSx7ImNoYXIiOiLkuIoifSx7ImNoYXIiOiLnnIsifSx7ImNoYXIiOiLvvIwifSx7ImNoYXIiOiLllK8ifSx7ImNoYXIiOiLkuIAifSx7ImNoYXIiOiLlj68ifSx7ImNoYXIiOiLog70ifSx7ImNoYXIiOiLmnIkifSx7ImNoYXIiOiLpl64ifSx7ImNoYXIiOiLpopgifSx7ImNoYXIiOiLnmoQifSx7ImNoYXIiOiLlsLEifSx7ImNoYXIiOiLmmK8ifSx7ImNoYXIiOiJtIn0seyJjaGFyIjoiYSJ9LHsiY2hhciI6ImwifSx7ImNoYXIiOiJsIn0seyJjaGFyIjoibyJ9LHsiY2hhciI6ImMifSx7ImNoYXIiOiLkuI4ifSx7ImNoYXIiOiJmIn0seyJjaGFyIjoiciJ9LHsiY2hhciI6ImUifSx7ImNoYXIiOiJlIn0seyJjaGFyIjoi6L+ZIn0seyJjaGFyIjoi5LqbIn0seyJjaGFyIjoi5raJIn0seyJjaGFyIjoi5Y+KIn0seyJjaGFyIjoi5YiwIn0seyJjaGFyIjoi5YaFIn0seyJjaGFyIjoi5a2YIn0seyJjaGFyIjoi5aSEIn0seyJjaGFyIjoi55CGIn0seyJjaGFyIjoi55qEIn0seyJjaGFyIjoi5Ye9In0seyJjaGFyIjoi5pWwIn0seyJjaGFyIjoi5LqGIn0seyJjaGFyIjoi77yMIn0seyJjaGFyIjoi5omAIn0seyJjaGFyIjoi5LulIn0seyJjaGFyIjoi77yMIn0seyJjaGFyIjoi5oqKIn0seyJjaGFyIjoi6L+ZIn0seyJjaGFyIjoi5LiqIn0seyJjaGFyIjoi5Ye9In0seyJjaGFyIjoi5pWwIn0seyJjaGFyIjoi5L+uIn0seyJjaGFyIjoi5pS5In0seyJjaGFyIjoi5oiQIn0seyJjaGFyIjoi5aaCIn0seyJjaGFyIjoi5LiLIn1dLCJpc1JpY2hUZXh0Ijp0cnVlLCJrZWVwTGluZUJyZWFrIjp0cnVlfX1d--></p>
<p> </p>
<pre>
<code> #define ARRAY_LEN 255
void Paint_DrawNum(UWORD Xpoint, UWORD Ypoint, double Nummber,
sFONT *Font, UWORD Digit, UWORD Color_Foreground, UWORD Color_Background)
{
#if 1
char Str;
sprintf(Str, "%.*lf", Digit, Nummber);
// char *pStr = (char *)malloc((strlen(Str)) * sizeof(char));
// memcpy(pStr, Str, (strlen(Str) - 1));
//*(pStr + strlen(Str) - 1) = '\0';
//if (Digit == 0)
// *(pStr + strlen(Str) - 2) = '\0';
// show
Paint_DrawString_EN(Xpoint, Ypoint, (const char *)Str, Font, Color_Foreground, Color_Background);
// free(pStr);
// pStr = NULL;
#endif
}</code></pre>
<p>再烧写到开发板上,程序顺利运行。</p>
<p><!--5f39ae17-8c62-4a45-bc43-b32064c9388a:W3siYmxvY2tJZCI6IjkzNDMtMTY2OTM0Mjc4NjUxNCIsImJsb2NrVHlwZSI6InBhcmFncmFwaCIsInN0eWxlcyI6eyJhbGlnbiI6ImxlZnQiLCJpbmRlbnQiOjAsInRleHQtaW5kZW50IjowLCJsaW5lLWhlaWdodCI6MS43NSwiYmFjay1jb2xvciI6IiIsInBhZGRpbmciOiIifSwidHlwZSI6InBhcmFncmFwaCIsInJpY2hUZXh0Ijp7ImRhdGEiOlt7ImNoYXIiOiLlho0ifSx7ImNoYXIiOiLng6cifSx7ImNoYXIiOiLlhpkifSx7ImNoYXIiOiLliLAifSx7ImNoYXIiOiLlvIAifSx7ImNoYXIiOiLlj5EifSx7ImNoYXIiOiLmnb8ifSx7ImNoYXIiOiLkuIoifSx7ImNoYXIiOiLvvIwifSx7ImNoYXIiOiLnqIsifSx7ImNoYXIiOiLluo8ifSx7ImNoYXIiOiLpoboifSx7ImNoYXIiOiLliKkifSx7ImNoYXIiOiLov5AifSx7ImNoYXIiOiLooYwifSx7ImNoYXIiOiLjgIIifV0sImlzUmljaFRleHQiOnRydWUsImtlZXBMaW5lQnJlYWsiOnRydWV9fV0=--></p>
<p> </p>
<p></p>
<p> </p>
</div><script> var loginstr = '<div class="locked">查看本帖全部内容,请<a href="javascript:;" style="color:#e60000" class="loginf">登录</a>或者<a href="https://bbs.eeworld.com.cn/member.php?mod=register_eeworld.php&action=wechat" style="color:#e60000" target="_blank">注册</a></div>';
if(parseInt(discuz_uid)==0){
(function($){
var postHeight = getTextHeight(400);
$(".showpostmsg").html($(".showpostmsg").html());
$(".showpostmsg").after(loginstr);
$(".showpostmsg").css({height:postHeight,overflow:"hidden"});
})(jQuery);
} </script><script type="text/javascript">(function(d,c){var a=d.createElement("script"),m=d.getElementsByTagName("script"),eewurl="//counter.eeworld.com.cn/pv/count/";a.src=eewurl+c;m.parentNode.insertBefore(a,m)})(document,523)</script> <p>微雪官方给的例程,和开发板不配套?</p>
nmg 发表于 2022-11-25 14:35
微雪官方给的例程,和开发板不配套?
<p>可能是SDK版本或是编译器版本不同的原因,毕竟官方提供的可烧写文件是正常的。</p>
<p>这个效果看着相当不错啊</p>
<p>这个问题是因为在while或者for循环中,编译器自作主张认为你是重复做无意义的事情,所以进行了优化。你会发现都是在while或者for中有问题,就是因为编译器聪明过头,认为你在做无意义重复的事,虽然实际上我们的重复是有意义的。</p>
<p>将相应的变量加上volatile修饰就可以了。</p>
<p>或者取消编译器优化,优化等级设置为-O0,这样程序会很大,效率低,不是我们期望的,一般我们还是会默认开编译器优化的。</p>
<p>楼上的大佬对这个理解到位呀,看后感触非凡。微雪的产品,也很给力。</p>
<p>楼主重启之后有没有遇到黑屏得情况?</p>
页:
[1]