常见泽1 发表于 2019-11-30 16:44

第二篇 GD32VF103C START 和ST官方例程简单比较

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">粗略看了下</span>GD<span style="font-family:宋体">的官方例程,感觉还是保持了</span>ST<span style="font-family:宋体">官方例程的大体结构,基本做过</span>ST<span style="font-family:宋体">开发的很容易能明白。基本差不多,除了库的位置放置略不同。</span></span></span></p>

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

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">下面这是</span>ST<span style="font-family:宋体">的官方例程的目录:</span></span></span></p>

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

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

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

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

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

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">我们打开</span>GD<span style="font-family:宋体">的官方例程</span></span></span></p>

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

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

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

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri,sans-serif">A<span style="font-family:宋体">.</span><span class="fontstyle01" style="font-family:ArialMT,serif"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span lang="EN-US" style="font-size:10.0pt">GD32VF103_standard_peripheral</span></span></span></span></span><span class="fontstyle11" style="font-family:宋体"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span style="font-size:10.0pt">子文件夹</span></span></span></span></span></span></span></p>

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

<p style="margin-left:14px; text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri,sans-serif">1.<span style="font-family:宋体">固件库头文件</span></span></span></p>

<p style="margin-left:14px; text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri,sans-serif">2.<span style="font-family:宋体">固件库源文件</span></span></span></p>

<p style="margin-left:14px; text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri,sans-serif">3.GD32VF103<span style="font-family:宋体">全局头文件和系统配置文件</span></span></span></p>

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

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri,sans-serif">B<span style="font-family:宋体">.</span><span class="fontstyle01" style="font-family:ArialMT,serif"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span lang="EN-US" style="font-size:10.0pt">GD32VF103_standard_peripheral</span></span></span></span></span><span class="fontstyle11" style="font-family:宋体"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span style="font-size:10.0pt">子文件夹</span></span></span></span></span></span></span></p>

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

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri,sans-serif">C. RSIC-V<span style="font-family:宋体">文件夹</span></span></span></p>

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

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

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

<p style="margin-left:14px; text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri,sans-serif"><span class="fontstyle01" style="font-family:ArialMT,serif"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span lang="EN-US" style="font-size:10.0pt">1.drivers</span></span></span></span></span><span class="fontstyle11" style="font-family:宋体"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span style="font-size:10.0pt">子文件夹包含</span></span></span></span></span><span class="fontstyle01" style="font-family:ArialMT,serif"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span lang="EN-US" style="font-size:10.0pt">RISC-V</span></span></span></span></span><span class="fontstyle11" style="font-family:宋体"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span style="font-size:10.0pt">内核的支持文件</span></span></span></span></span></span></span></p>

<p style="margin-left:14px; text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri,sans-serif">2.<span class="fontstyle01" style="font-family:ArialMT,serif"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span lang="EN-US" style="font-size:10.0pt"> env_Eclipse</span></span></span></span></span><span class="fontstyle11" style="font-family:宋体"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span style="font-size:10.0pt">子文件夹包含了基于</span></span></span></span></span><span class="fontstyle01" style="font-family:ArialMT,serif"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span lang="EN-US" style="font-size:10.0pt">RISC-V</span></span></span></span></span><span class="fontstyle11" style="font-family:宋体"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span style="font-size:10.0pt">内核处理器的启动代码、 异常服务程序及链接脚</span></span></span></span></span><br />
<span class="fontstyle11" style="font-family:宋体"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span style="font-size:10.0pt">本文件</span></span></span></span></span></span></span></p>

<p style="margin-left:14px; text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri,sans-serif">3.<span class="fontstyle01" style="font-family:ArialMT,serif"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span lang="EN-US" style="font-size:10.0pt"> stubs</span></span></span></span></span><span class="fontstyle11" style="font-family:宋体"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span style="font-size:10.0pt">子文件夹包含了</span></span></span></span></span><span class="fontstyle01" style="font-family:ArialMT,serif"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span lang="EN-US" style="font-size:10.0pt">_write</span></span></span></span></span><span class="fontstyle11" style="font-family:宋体"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span style="font-size:10.0pt">、 </span></span></span></span></span><span class="fontstyle01" style="font-family:ArialMT,serif"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span lang="EN-US" style="font-size:10.0pt">_read</span></span></span></span></span><span class="fontstyle11" style="font-family:宋体"><span style="color:black"><span style="font-weight:normal"><span style="font-style:normal"><span style="font-size:10.0pt">等桩函数的定义</span></span></span></span></span></span></span></p>

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

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">工程放置位置:</span></span></span></p>

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

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

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">打开</span>key<span style="font-family:宋体">中断例程工程文件夹:</span></span></span></p>

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

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri,sans-serif">1.gd32vf103_it.c/.h</span></span></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">中断处理程序及头文件,和</span>ST<span style="font-family:宋体">的类似</span></span></span></p>

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

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri,sans-serif">2.gd32vf103_libopt.h</span></span></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">设置例程所使用的外设,包含了什么</span>adc.h gpio.h<span style="font-family:宋体">头文件,感觉有点像</span>ST<span style="font-family:宋体">的</span>conf.h<span style="font-family:宋体">那个头文件</span>(<span style="font-family:宋体">个人感觉,可能并不是这个意思</span>)</span></span></p>

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

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri,sans-serif">3.main.c</span></span></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">用户的例程</span></span></span></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri,sans-serif">4.systick.c</span></span></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">使用</span>systick<span style="font-family:宋体">的精准延时程序</span></span></span></p>

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

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">代码对比</span></span></span></p>

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

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

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">简单拿一个</span>GPIO<span style="font-family:宋体">例程来,</span>GD RISC-V<span style="font-family:宋体">的和</span>ST M3<span style="font-family:宋体">的很相似,只是库函数的名字改了,基本参数名字改了,时钟和</span>IO<span style="font-family:宋体">口需要配置的东西基本类似。</span></span></span></p>

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

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri,sans-serif">GD<span style="font-family:宋体">的</span>GPIO<span style="font-family:宋体">函数库如下</span></span></span></p>

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

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

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">所以我们编程只要抓住</span>GD<span style="font-family:宋体">的库函数手册就可以啦,就是</span>GD32VF103 <span style="font-family:宋体">固件库用户指南</span>.pdf<span style="font-family:宋体">。</span></span></span></p>

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

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

hotsauce1861 发表于 2019-11-30 19:14

是否可以无缝兼容STM32啊

常见泽1 发表于 2019-12-2 09:34

hotsauce1861 发表于 2019-11-30 19:14
是否可以无缝兼容STM32啊

<p>不可以啊 这个测评的RISC-V内核的</p>

zeshoufx 发表于 2020-1-19 15:03

他这些库函数名称和参数与gd32f103很像,,,很多就是一样的
页: [1]
查看完整版本: 第二篇 GD32VF103C START 和ST官方例程简单比较