最近买了一个ESP32的开发板 【 https://www.espressif.com/zh-hans/products/hardware/esp32-devkitc/overview 】,这里笔记下如何最简单使用。
CONTENTS
官方文档介绍
【 https://docs.espressif.com/projects/esp-idf/zh_CN/latest/hw-reference/get-started-devkitc.html 】
【 https://docs.espressif.com/projects/esp-idf/zh_CN/latest/get-started/index.html 】
本地编译环境准备
参考 设置开发环境章节【 https://docs.espressif.com/projects/esp-idf/zh_CN/latest/get-started/index.html#id6 】,作者本地是ubuntu环境,所以很简单,直接命令行安装即可。
$ sudo apt-get install git wget flex bison gperf python python-pip python-setuptools python-serial python-click python-cryptography python-future python-pyparsing python-pyelftools cmake ninja-build ccache libffi-dev libssl-dev $ mkdir ~/esp $ cd ~/esp $ git clone --recursive https://github.com/espressif/esp-idf.git $ cd esp-idf/ $ sudo ./install.sh $ . ./export.sh
将export.sh执行放到.profile中,参考如下:
$ cat ~/.profile 。。。。。 。。。。。 if [ -d "$HOME/.local/bin" ] ; then PATH="$HOME/.local/bin:$PATH" fi . $HOME/esp/esp-idf/export.sh
将当前用户加入到dialout组中,要重新登录才会生效
$ sudo usermod -aG dialout `whoami`
Hello World
将helloworld工程拷贝到esp-idf平目录中:
$ cp -rf esp-idf/examples/get-started/hello_world ./
连接上开发板:
$ lsusb 。。。。。 Bus 002 Device 009: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP210x UART Bridge / myAVR mySmartUSB light 。。。。。
进入hello_world目录中,编译烧录执行:
$ esp/hello_world$ idf.py flash 。。。。。 。。。。。
查看日志输出,使用快捷键 Ctrl+] 退出:
$ esp/hello_world$ idf.py monitor 。。。。。 。。。。。
发表评论