hl23889909 发表于 2022-3-14 09:13

【GD32L233C-START评测】四 性能测试

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线">性能测试</span></span></p>

<ul>
        <li style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线">Coremark</span></span></li>
</ul>

<p style="text-indent:21.0pt; text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线">CoreMark是一个用于测量嵌入式系统中使用的中央处理器(CPU)的性能。它是在2009由eembc的shay gal-on开发的,旨在成为一个行业标准,取代过时的dehrystone基准。代码用C编写,包含以下算法:列表处理(增删改查和排序)、矩阵操作(公共矩阵操作)、状态机(确定输入流是否包含有效数字)和CRC。用户可以自由的下载Coremark,并移植到自己的平台上运行,随后就可以看到分数。</span></span></p>

<ul>
        <li style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线">移植</span></span></li>
</ul>

<p style="margin-bottom:24px"><span style="font-size:12pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#2e2e2e">我们在选择一款</span><span lang="EN-US" style="font-family:&quot;Trebuchet MS&quot;,sans-serif"><span style="color:#2e2e2e">MCU</span></span><span style="color:#2e2e2e">时,一般会综合考虑各方面的指标,如功耗、外设丰富程度、计算性能等等。其中在我们谈论计算性能时,一般只是简单地对比一下内核主频,但这并不能直观对比出一款</span><span lang="EN-US" style="font-family:&quot;Trebuchet MS&quot;,sans-serif"><span style="color:#2e2e2e">MCU</span></span><span style="color:#2e2e2e">的实际性能。相同主频的</span><span lang="EN-US" style="font-family:&quot;Trebuchet MS&quot;,sans-serif"><span style="color:#2e2e2e">MCU</span></span><span style="color:#2e2e2e">,有可能性能差异要比你想象的大。而基准测试则可以很直观地对比出一款处理器的性能,不用在考虑性能时犹豫了,也可以让您发现您产品的瓶颈,优化产品的性能。在这里,我们将教您自己去移植</span><span lang="EN-US" style="font-family:&quot;Trebuchet MS&quot;,sans-serif"><span style="color:#2e2e2e">CoreMark</span></span><span style="color:#2e2e2e">测试一款</span><span lang="EN-US" style="font-family:&quot;Trebuchet MS&quot;,sans-serif"><span style="color:#2e2e2e">MCU</span></span><span style="color:#2e2e2e">的</span><span lang="EN-US" style="font-family:&quot;Trebuchet MS&quot;,sans-serif"><span style="color:#2e2e2e">CoreMark</span></span><span style="color:#2e2e2e">性能。</span></span></span></span></p>

<p style="margin-bottom:24px; text-align:start"><span style="font-size:12pt"><span style="background:white"><span style="font-variant-ligatures:normal"><span style="text-decoration-thickness:initial"><span style="text-decoration-style:initial"><span style="text-decoration-color:initial"><span style="font-family:宋体"><strong><span lang="EN-US" style="font-family:&quot;Trebuchet MS&quot;,sans-serif"><span style="color:#2e2e2e">CoreMark</span></span></strong><strong><span style="font-family:宋体"><span style="color:#2e2e2e">移植到一款</span></span></strong><strong><span lang="EN-US" style="font-family:&quot;Trebuchet MS&quot;,sans-serif"><span style="color:#2e2e2e">MCU</span></span></strong><strong><span style="font-family:宋体"><span style="color:#2e2e2e">上有几步</span></span></strong></span></span></span></span></span></span></span></p>

<ul>
        <li style="margin-bottom:24px; margin-left:48px"><span style="font-size:12pt"><span style="background:white"><span style="tab-stops:list 36.0pt"><span style="font-family:宋体"><span style="color:#2e2e2e">获取</span><span lang="EN-US" style="font-family:&quot;Trebuchet MS&quot;,sans-serif"><span style="color:#2e2e2e">CoreMark</span></span><span style="color:#2e2e2e">源码</span></span></span></span></span></li>
        <li style="margin-bottom:24px; margin-left:48px"><span style="font-size:12pt"><span style="background:white"><span style="tab-stops:list 36.0pt"><span style="font-family:宋体"><span style="color:#2e2e2e">实现平台打印输出函数</span></span></span></span></span></li>
        <li style="margin-bottom:24px; margin-left:48px"><span style="font-size:12pt"><span style="background:white"><span style="tab-stops:list 36.0pt"><span style="font-family:宋体"><span style="color:#2e2e2e">修改平台相关宏定义</span></span></span></span></span></li>
        <li style="margin-bottom:24px; margin-left:48px"><span style="font-size:12pt"><span style="background:white"><span style="tab-stops:list 36.0pt"><span style="font-family:宋体"><span style="color:#2e2e2e">实现计时相关函数</span></span></span></span></span></li>
        <li style="margin-bottom:24px; margin-left:48px"><span style="font-size:12pt"><span style="background:white"><span style="tab-stops:list 36.0pt"><span style="font-family:宋体"><span style="color:#2e2e2e">编译与运行</span><span lang="EN-US" style="font-family:&quot;Trebuchet MS&quot;,sans-serif"><span style="color:#2e2e2e">CoreMark</span></span></span></span></span></span></li>
</ul>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线">我是直接下载了网上别人移植到ST上的源码,串口初始化换成GD的,然后用printf,在改下SysTick计时就可以测试了。</span></span></p>

<p style="text-align:justify">&nbsp;</p>

<p style="text-align:justify"> &nbsp;</p>

<p style="text-align:justify"> &nbsp;</p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线">初始化还是用原来的1ms中断,中断里只计数放别的会影响测试性能。</span></span></p>

<ul>
        <li style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线">测试</span></span></li>
</ul>

<p style="margin-left:28px; text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线">程序下载进去等待看打印信息即可:</span></span></p>

<p style="margin-left:28px; text-align:justify"> &nbsp;</p>

<p style="margin-left:28px; text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线">什么鬼?才20分,而且等了一分钟多才出结果,是的没看错这是事实,因为为了调试USB我工程把主频改成48M的了。改成64M试试,说干就干:</span></span></p>

<p style="margin-left:28px; text-align:justify"> &nbsp;</p>

<p style="margin-left:28px; text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线">才27.4?&hellip;&hellip;&hellip;</span></span></p>

<p style="margin-left:28px; text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线">后面看了下工程优化等级要改成优化3及Q3,改后重新编译,烧录:</span></span></p>

<p style="margin-left:28px; text-align:justify"> &nbsp;</p>

<p style="margin-left:28px; text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线">出来103这个值看起来还可以,一想我的定时中断还有延时和串口的处理,干掉在测试下:</span></span></p>

<p style="margin-left:28px; text-align:justify"> &nbsp;</p>

<p style="margin-left:28px; text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线">出来105,后面在多尝试几次都是这个值了,应该就是最终值了。</span></span></p>

<ul>
        <li style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线">总结</span></span></li>
</ul>

<ol>
        <li style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线">对于低功耗单片机跑出这个性能也还算满意,网上看别人测试ST的103才跑了84分,对应不同单片机大家可以自己测试,或者看官方的跑分测试结果。</span></span></li>
        <li style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线">计时中断放的延时处理接口,看是就进去下判断然后&mdash;计时几条指令,中断频繁的话,还是比较耗性能的。</span></span></li>
        <li style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线">最后是这个优化等级,之前写代码一直都不注意这个参数,只有空间不够的时候才会想着优化编译节省空间,原来优化编译还会影响性能。</span></span></li>
</ol>

freebsder 发表于 2022-3-14 22:43

<p>coremark要替代点灯成必跑项目了。</p>
页: [1]
查看完整版本: 【GD32L233C-START评测】四 性能测试