【ESP32-Korvo测评】 07 编译第一个工程hello world
<p style="text-align:justify"><span style="font-size:16px;"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">花了一周的几个晚上终于把</span>ESP-IDF<span style="font-family:宋体">开发环境搭建好了,为了验证有无问题还是编译一个工程看看。</span></span></span></p><p style="text-align:justify"> </p>
<p style="text-align:justify"><span style="font-size:16px;"><span style="font-family:Calibri,sans-serif">ESP-IDF<span style="font-family:宋体">安装好后,会在</span>examples<span style="font-family:宋体">目录下生成很多例程,老生常谈,我们以经典的</span>Hello world<span style="font-family:宋体">工程为例进行尝试。</span></span></span></p>
<p style="text-align:justify"> </p>
<p style="text-align: justify;"><span style="font-size:16px;"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">启动</span>ESP-IDF Command Prompt.exe<span style="font-family:宋体">,使用</span>cd<span style="font-family:宋体">命令将目录定位到:</span></span></span></p>
<p style="text-align: justify;"><span style="font-size:16px;"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">“</span>examples\get-started\hello_world<span style="font-family:宋体">”。</span></span></span></p>
<p><span style="font-size:16px;"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">(1)输入命令:</span>idf.py set-target esp32<span style="font-family:宋体">,设置目标芯片类型;</span></span></span></p>
<p style="text-align: justify;"><span style="font-size:16px;"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">(2)输入命令:</span>idf.py menuconfig<span style="font-family:宋体">,进入配置几面;</span></span></span></p>
<p style="text-align: justify;"><span style="font-size:16px;"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">由于对于</span>hello world<span style="font-family:宋体">例程来讲,不需要什么额外的配置。</span></span></span></p>
<p style="text-align: justify;"><span style="font-size:16px;"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">进入</span>Flash Size<span style="font-family:宋体">配置界面,默认为</span>2MB<span style="font-family:宋体">,而开发板使用的</span>ESP32-WROVER<span style="font-family:宋体">模组默认为</span>4MB<span style="font-family:宋体">大小,所以此处先将</span>flash size<span style="font-family:宋体">配置为</span>4MB<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"><span style="font-size:16px;"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">保存后,退出</span>menuconfig<span style="font-family:宋体">配置界面。</span></span></span></p>
<p style="text-align:justify"><span style="font-size:16px;"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">(3)输入命令:</span>idf.py build<span style="font-family:宋体">,开始编译工程;</span></span></span></p>
<p style="text-align:justify"><span style="font-size:16px;"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">虽然只是一个简单的</span>hello world<span style="font-family:宋体">程序,但是编译时间都很长,等待一段时间后,可以看到编译成功的消息,并生成一个</span>hello-world.bin<span style="font-family:宋体">文件。</span></span></span></p>
<p style="text-align:justify"></p>
<p style="text-align:justify"><span style="font-size:16px;"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">(4)输入命令:</span>idf.py -p COM3 flash<span style="font-family:宋体">,将</span>bin<span style="font-family:宋体">文件烧写到开发板</span>ESP32<span style="font-family:宋体">模组的</span>Flash<span style="font-family:宋体">中;</span></span></span></p>
<p style="text-align:justify"></p>
<p style="text-align:justify"><span style="font-size:16px;"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">(5)输入命令:</span>idf.py -p COM3 monitor<span style="font-family:宋体">,启动串口监视器,可以看到程序打印的日志信息。</span></span></span></p>
<p style="text-align:justify"></p>
<p style="text-align:justify"><span style="font-size:16px;"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">通过</span>hello world<span style="font-family:宋体">的演示,说明开发环境搭建成功,可以愉快的使用了。</span></span></span></p>
<p>玩开发板,环境做完后,最爽的就是看到“ hello world ”<img height="50" src="https://bbs.eeworld.com.cn/static/editor/plugins/hkemoji/sticker/facebook/wanwan21.gif" width="63" /></p>
<p>感谢分享,期待后续评测</p>
<p>linux下照着做比较顺利,win没试过。关键是网络</p>
页:
[1]