Zephyr笔记3 - 使用Eclipse调试Zephyr
<p>Zephyr版本号:<span style="color: rgb(255, 0, 0);">2.2.0</span></p><p>开发板:<span style="color: rgb(255, 0, 0);">STM32F429IGT6(野火STM32F429挑战者 V2开发板)</span></p><p>开发环境:<span style="color: rgb(255, 0, 0);">Windows 7 64位</span></p><p style="text-indent: 2em;">这里选择的是Zephyr当前最新的Release版本2.2.0进行说明的。</p><p style="text-indent: 2em;">当需要熟悉Zephyr的具体运行过程,那么调试就必不可少,例如在调试任务切换时,需要观察CPU状态以及各个寄存器的情况,此时图形界面下的调试更为方便。下面讲讲如何使用Eclipse搭配JLink来调试HelloWold应用程序。</p><p class="artical_littlestyle1">1、设置Eclipse环境</p><p>(1).下载并安装Eclipse</p><p style="text-indent: 2em;">从Eclipse网站下载Eclipse IDE for C/C++ Developers,然后进行安装。下载网址:<a href="https://www.eclipse.org/downloads/packages/release/oxygen/2/eclipse-ide-cc-developers" target="_blank">https://www.eclipse.org/downloads/packages/release/oxygen/2/eclipse-ide-cc-developers</a>。</p><p>(2).安装GNU MCU Eclipse插件</p><p style="text-indent: 2em;">打开安装好的Eclipse,在<span style="color: rgb(0, 112, 192);">Help</span>(或者<span style="color: rgb(0, 112, 192);">Window</span>)菜单下面找到<span style="color: rgb(0, 112, 192);">Eclipse Marketplace</span>,然后在Find输入框中输入<span style="color: rgb(0, 112, 192);">GNU MCU eclipse</span>,按Enter键进行搜索,找到<span style="color: rgb(0, 112, 192);">GNU MCU eclipse</span>插件之后,点击Install按钮,我这里之前已经安装好了,如下图所示:</p><p style="text-align:center"><img src="/uploads/AilsonJack/2020.06.14/1592130253801676.png" onclick="preview_image('/uploads/AilsonJack/2020.06.14/1592130253801676.png')"/></p><p class="artical_littlestyle2">2、生成Eclipse工程</p><p style="text-indent: 2em;">确定命令提示符的路径在Zephyr2.2.0源代码目录中,执行下述命令来生成Eclipse的工程文件:</p><p><span style="color: rgb(0, 112, 192);">west build -p auto -b stm32f429i_disc1 samples/hello_world -- -G"Eclipse CDT4 - Ninja"</span></p><p style="text-indent: 2em;">生成的Eclipse工程文件<span style="color: rgb(0, 112, 192);">.project</span>在<span style="color: rgb(0, 112, 192);">build</span>目录下。</p><p class="artical_littlestyle3">3、将工程导入到Eclipse</p><p style="text-indent: 2em;">打开安装好的Eclipse,在<span style="color: rgb(0, 112, 192);">File</span>菜单下面点击<span style="color: rgb(0, 112, 192);">Import…</span>,在弹出的窗口中选择<span style="color: rgb(0, 112, 192);">General</span> -> <span style="color: rgb(0, 112, 192);">Existing Projects into Workspace</span>,然后点击<span style="color: rgb(0, 112, 192);">Next</span>,然后添加Zephyr的build的路径,点击<span style="color: rgb(0, 112, 192);">Refresh</span>,选中添加的工程之后点击<span style="color: rgb(0, 112, 192);">Finish</span>:</p><p style="text-align:center"><img src="/uploads/AilsonJack/2020.06.14/1592130257504105.png" onclick="preview_image('/uploads/AilsonJack/2020.06.14/1592130257504105.png')"/></p><p style="text-align:center"><img src="/uploads/AilsonJack/2020.06.14/1592130262922720.png" onclick="preview_image('/uploads/AilsonJack/2020.06.14/1592130262922720.png')"/></p><p class="artical_littlestyle4">4、创建调试器配置文件</p><p style="text-indent: 2em;">工程导入完成之后,接下来配置调试器,打开菜单<span style="color: rgb(0, 112, 192);">Run</span> -> <span style="color: rgb(0, 112, 192);">Debug Configurations...</span>,在弹出的窗口中双击<span style="color: rgb(0, 112, 192);">GDB SEGGER J-Link Debugging</span>生成调试配置文件。</p><p>Main标签页的配置:</p><p> Project:<span style="color: rgb(0, 112, 192);">hello_world@build</span></p><p> C/C++ Application:<span style="color: rgb(0, 112, 192);">zephyr/zephyr.elf</span></p><p style="text-align:center"><img src="/uploads/AilsonJack/2020.06.14/1592130265255732.png" onclick="preview_image('/uploads/AilsonJack/2020.06.14/1592130265255732.png')"/></p><p>Debugger标签页的配置:</p><p> J-Link GDB Server Setup:</p><p> Start the J-Link GDB server locally:<span style="color: rgb(0, 112, 192);">取消勾选</span></p><p> GDB Client Setup:</p><p> Executable:<span style="color: rgb(0, 112, 192);">arm-none-eabi-gdb.exe</span></p><p style="text-align:center"><img src="/uploads/AilsonJack/2020.06.14/1592130278307542.png" onclick="preview_image('/uploads/AilsonJack/2020.06.14/1592130278307542.png')"/></p><p style="text-align:center"><img src="/uploads/AilsonJack/2020.06.14/1592130279356015.png" onclick="preview_image('/uploads/AilsonJack/2020.06.14/1592130279356015.png')"/></p><p>Startup标签页的配置:</p><p> Initial Reset and Halt:<span style="color: rgb(0, 112, 192);">取消勾选</span></p><p> Enable semihosting:<span style="color: rgb(0, 112, 192);">取消勾选</span></p><p> Enable SWO:<span style="color: rgb(0, 112, 192);">取消勾选</span>,如下图所示:</p><p style="text-align:center"><img src="/uploads/AilsonJack/2020.06.14/1592130312700902.png" onclick="preview_image('/uploads/AilsonJack/2020.06.14/1592130312700902.png')"/></p><p>Set breakpoint at: <span style="color: rgb(0, 112, 192);">__start</span><br/></p><p style="text-align:center"><img src="/uploads/AilsonJack/2020.06.14/1592130285650385.png" onclick="preview_image('/uploads/AilsonJack/2020.06.14/1592130285650385.png')"/></p><p>Common标签页的配置如下图红色方框所示:</p><p style="text-align:center"><img src="/uploads/AilsonJack/2020.06.14/1592130292124910.png" onclick="preview_image('/uploads/AilsonJack/2020.06.14/1592130292124910.png')"/></p><p class="artical_littlestyle1">5、运行调试器</p><p style="text-indent: 2em;">在使用Eclipse调试Zephyr之前,先打开<span style="color: rgb(0, 112, 192);">JLink GDB Server</span>,然后再点击Eclipse调试按钮下拉菜单的<span style="color: rgb(0, 112, 192);">hello_world_build Configuration</span>调试选项:</p><p style="text-align:center"><img src="/uploads/AilsonJack/2020.06.14/1592130295793490.png" onclick="preview_image('/uploads/AilsonJack/2020.06.14/1592130295793490.png')"/></p><p style="text-align:center"><img src="/uploads/AilsonJack/2020.06.14/1592130305327299.png" onclick="preview_image('/uploads/AilsonJack/2020.06.14/1592130305327299.png')"/></p><p>点击调试按钮等一小会儿之后,出现了调试界面,惊喜吧:</p><p style="text-align:center"><img src="/uploads/AilsonJack/2020.06.14/1592130308297854.png" onclick="preview_image('/uploads/AilsonJack/2020.06.14/1592130308297854.png')"/></p><p style="text-indent: 2em;">之后的步骤,就是自己动手调试代码啦。</p><p style="text-indent: 2em;">如果这篇文章对你有帮助,记得点赞和关注博主就行了^_^。</p>
你可能也喜欢:
暂无评论,要不要来个沙发
发表评论
JLink V9掉固件修复(灯不亮) 3Zephyr笔记2 - 在STM32F429上运行HelloWorld 2计算NandFlash要传入的行地址和列地址 1Linux MMC子系统 - 6.eMMC 5.1工作模式-设备识别模式 0Linux MMC子系统 - 5.eMMC 5.1工作模式-引导模式 0Linux MMC子系统 - 4.eMMC 5.1常用命令说明(2) 0
标签云
Linux嵌入式实用技巧ARM内核学习问题集合CC++编程语言阅读笔记汇编Linux内核完全注释Windows驱动开发计算机基础ARM11ARMv7-ASTM32IDESublimeLinux内核学习eMMCMMC子系统Ubuntu操作系统OfficeVMWareAPUEgccRTOS中断漫游世界随笔感悟开发工具软件应用编程VsCodearmccarmclang编译器ZephyrSPIJLink网卡驱动安装各种芯片库函数NFSμCOS内核sambaFlashUnix命令与脚本输入法Linux内核设计与实现gitRIFFWAVJATGFTPar8161安装centos有线上网μCGUI字库工程建立右键菜单网络文件系统Firefox百度NTFS文件系统CodeBlocksCentOS数据结构算法PhotoShop51KeilQTUltraEditscanfglibc宏定义UIDGID优先级娱乐天地SourceInsight磁盘扇区总线I2CPDFBComparePythonI2SFPUMakefileSWDCPUARP软件推荐FileZilla