ESP32 是一套 Wi-Fi (2.4 GHz) 和蓝牙 (4.2) 双模解决方案,集成了高性能的 CPU 内核、超低功耗协处理器和丰富的外设。ESP32 采用 40 nm 工艺制成,具有最佳的功耗性能、射频性能、稳定性、通用性和可靠性,适用于各种应用和不同功耗需求。
乐鑫为用户提供完整的软、硬件资源进行 ESP32 设备的开发。乐鑫所研发的软件开发环境 ESP-IDF 能够帮助用户快速开发物联网 (IoT) 应用,满足用户对于 Wi-Fi、蓝牙、低功耗等性能的需求。
开发环境的准备工作:
1.下载交叉开发工具链和配置交叉开发工具链环境变量,Linux 版的 ESP32 工具链可以从 Espressif 的网站下载:
-
64-bit Linux:
https://dl.espressif.com/dl/xtensa-esp32-elf-linux64-1.22.0-80-g6c4433a-5.2.0.tar.gz
-
32-bit Linux:
https://dl.espressif.com/dl/xtensa-esp32-elf-linux32-1.22.0-80-g6c4433a-5.2.0.tar.gz
配置交叉开发工具链环境变量:
$ sudo gedit /etc/profile
在/etc/profile最后添加export PATH=$PATH:$HOME/esp/xtensa-esp32-elf/bin //$HOME/esp/xtensa-esp32-elf/bin是工具链路径
$ source /etc/profile //使环境变量马上生效,不然得重启才生效
2.安装依赖及下载esp32开发包esp-idf
$ sudo apt-get install gcc git wget make libncurses-dev flex bison gperf python python-pip python-setuptools python-serial
$ cd ~/esp
$ git clone --recursive https://github.com/espressif/esp-idf.git
$ sudo gedit /etc/profile //配置IDF_PATH变量,在最后面添加export IDF_PATH=$HOME/esp/esp-idf
$ source /etc/profile
3.运行hello_world示例测试
$ cd $HOME/esp/esp-idf/examples/get-started/hello_world
$ make menuconfig //进入Serial flasher config选择正确的串口号
$ make -j4 flash monitor //编译hello_world并自动烧写到flash