ubuntu 16.04 安装esp32环境

 首先查看一下官网的快速入门,这里有最基本的流程。espressif快速入门  遗憾的是,我照着做了一遍,总会有各种奇怪的事情发生,遂放弃。

目录

1. 安装准备

2. 获取ESP-IDF 

3.设置IDF_PATH路径

4.安装工具链

5. 执行例程


1. 安装准备

首先,建立一个文件夹esp,我们所有的东西都会放到文件夹中

mkdir esp

之后,安装依赖:

sudo apt-get install git wget flex bison gperf python3 python3-pip python3-setuptools cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0

 以及工具链的依赖

sudo apt-get install git make gcc libncurses5-dev flex bison gperf python-serial

2. 获取ESP-IDF 

这里,要用git命令拉取,不能直接下载去使用,会报错。

但是,用官网上的命令去git,会发现真的是龟速,而且还会报错(子模块出错)。找到了一个博客里面的方法可以用。

主要有三步:

1.拉取源码

2.之后会发现生成了一个esp-idf文件夹,进入

3.拉取子模块

下面三行命令依次代表了上面三个步骤,一行一行执行即可:

sudo git clone https://gitee.com/xuhongv/esp-idf.git
cd esp-idf
git submodule update --init --recursive

第三步内容比较多,还是会慢一点,但是比官网直接git要快的多,而且不容易出错。

3.设置IDF_PATH路径

这里就相当于windows环境下的环境变量。

3.1. 打开 bashrc 

vim ~/.bashrc

3.2.输入 i 进入插入模式,在末尾写入

export IDF_PATH=/home/esp/esp-idf

IDF_PATH后面的路径要换成自己的esp-idf路径

3.3按下esc进入命令模式,之后输入:wq 保存退出即可

3.4.执行刚才更改的文件

source ~/.bashrc

3.5. 查看IDF_PATH是否设置成功

echo $IDF_PATH

4.安装工具链

4.1进入esp_idf目录,执行install.sh,命令如下:

./install.sh

但是,这个过程主要是下载、解压各种工具包,可能很慢很慢,也可能会出现各种错误,对于出现的错误,我建议大家去把要下载的包先下载下来之后再去执行这条命令,会发现一路畅通。这里我放一下我下载的工具链:

(tensorflow-gpu) ly@ly-MS-7B51:~/espressif/dist$ ll ~/.espressif/dist
总用量 418136
drwxrwxr-x 2 ly   ly        4096 6月  19 17:51 ./
drwxrwxr-x 5 ly   ly        4096 6月  20 08:50 ../
-rw-r--r-- 1 root root   8254018 6月  19 17:51 binutils-esp32s2ulp-linux-amd64-2.28.51-esp-20191205.tar.gz
-rw-r--r-- 1 root root   8248656 6月  19 16:50 binutils-esp32ulp-linux-amd64-2.28.51-esp-20191205.tar.gz
-rw-r--r-- 1 root root   1773107 6月  19 17:51 openocd-esp32-linux64-0.10.0-esp32-20210401.tar.gz
-rw-r--r-- 1 root root 152042971 6月  19 16:50 riscv32-esp-elf-gcc8_4_0-crosstool-ng-1.24.0-123-g64eb9ff-linux-amd64.tar.gz
-rw-r--r-- 1 root root  85731226 6月  19 16:49 xtensa-esp32-elf-gcc8_4_0-esp-2020r3-linux-amd64.tar.gz
-rw-r--r-- 1 root root  86069526 6月  19 16:49 xtensa-esp32s2-elf-gcc8_4_0-esp-2020r3-linux-amd64.tar.gz
-rw-r--r-- 1 root root  86029457 6月  19 16:49 xtensa-esp32s3-elf-gcc8_4_0-esp-2020r3-linux-amd64.tar.gz

我把我下载好的工具包放在百度网盘了,需要的可以自取。

链接: https://pan.baidu.com/s/1OfZhBcvFcTWFRplvm_yDZA 提取码: ex5m 

另外,有可能你们用的版本和我的版本不一致,我这里把各个包下载的地址记录一下:

binutils-esp32ulp  https://github.com/espressif/binutils-esp32ulp/releases

openocd-esp32    https://github.com/espressif/openocd-esp32/releases

xtensa-esp32       https://github.com/espressif/crosstool-NG/releases/

进入各个链接之后,直接找到你们所需要的版本下载即可。

使用已经下载好的工具链包,进行install,命令如下:(在原来的基础上,后面添加工具链的地址即可)

(tensorflow-gpu) ly@ly-MS-7B51:~/esp/esp-idf$ ./install.sh /home/ly/espressif/dist
Detecting the Python interpreter
Checking "python" ...
Python 3.6.10 :: Anaconda, Inc.
"python" has been detected
Installing ESP-IDF tools
Installing tools: xtensa-esp32-elf, xtensa-esp32s2-elf, xtensa-esp32s3-elf, riscv32-esp-elf, esp32ulp-elf, esp32s2ulp-elf, openocd-esp32
Skipping [email protected] (already installed)
Skipping [email protected] (already installed)
Skipping [email protected] (already installed)
Skipping [email protected]_64eb9ff-8.4.0 (already installed)
Skipping [email protected] (already installed)
Skipping [email protected] (already installed)
Skipping [email protected] (already installed)
Installing Python environment and packages
Creating a new Python environment in /home/ly/.espressif/python_env/idf4.4_py3.6_env
Installing virtualenv
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting virtualenv
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/03/08/f819421002e85a71d58368f7bffbe0b1921325e0e8ca7857cb5fb0e1f7c1/virtualenv-20.4.7-py2.py3-none-any.whl (7.2 MB)
     |████████████████████████████████| 7.2 MB 2.1 MB/s 
Collecting appdirs<2,>=1.4.3
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/3b/00/2344469e2084fb287c2e0b57b72910309874c3245463acd6cf5e3db69324/appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB)
Requirement already satisfied: importlib-metadata>=0.12 in /home/ly/anaconda2/envs/py3/envs/tensorflow-gpu/lib/python3.6/site-packages (from virtualenv) (1.7.0)
Collecting filelock<4,>=3.0.0
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/93/83/71a2ee6158bb9f39a90c0dea1637f81d5eef866e188e1971a1b1ab01a35a/filelock-3.0.12-py3-none-any.whl (7.6 kB)
Collecting distlib<1,>=0.3.1
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/87/26/f6a23dd3e578132cf924e0dd5d4e055af0cd4ab43e2a9f10b7568bfb39d9/distlib-0.3.2-py2.py3-none-any.whl (338 kB)
     |████████████████████████████████| 338 kB 16.6 MB/s 
Requirement already satisfied: six<2,>=1.9.0 in /home/ly/anaconda2/envs/py3/envs/tensorflow-gpu/lib/python3.6/site-packages (from virtualenv) (1.15.0)
Collecting importlib-resources>=1.0
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/a4/30/b230b6586bcf6b80752ae42979f3b0da70bbde977d2b73eafd20c693b3db/importlib_resources-5.1.4-py3-none-any.whl (26 kB)
Requirement already satisfied: zipp>=0.5 in /home/ly/anaconda2/envs/py3/envs/tensorflow-gpu/lib/python3.6/site-packages (from importlib-metadata>=0.12->virtualenv) (3.1.0)
Installing collected packages: importlib-resources, filelock, distlib, appdirs, virtualenv
Successfully installed appdirs-1.4.4 distlib-0.3.2 filelock-3.0.12 importlib-resources-5.1.4 virtualenv-20.4.7
created virtual environment CPython3.6.10.final.0-64 in 461ms
  creator CPython3Posix(dest=/home/ly/.espressif/python_env/idf4.4_py3.6_env, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/ly/.local/share/virtualenv)
    added seed packages: pip==21.1.2, setuptools==57.0.0, wheel==0.36.2
  activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator
Installing Python packages from /home/ly/esp/esp-idf/requirements.txt
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple, https://dl.espressif.com/pypi
Ignoring None: markers 'sys_platform == "win32"' don't match your environment
Requirement already satisfied: setuptools>=21 in /home/ly/.espressif/python_env/idf4.4_py3.6_env/lib/python3.6/site-packages (from -r /home/ly/esp/esp-idf/requirements.txt (line 4)) (57.0.0)
Collecting click>=7.0
  Downloading https://dl.espressif.com/pypi/click/click-8.0.1-py3-none-any.whl (97 kB)
     |████████████████████████████████| 97 kB 427 kB/s 
Collecting pyserial>=3.3
  Downloading https://dl.espressif.com/pypi/pyserial/pyserial-3.5-py2.py3-none-any.whl (90 kB)
     |████████████████████████████████| 90 kB 903 kB/s 
Collecting future>=0.15.2
  Downloading https://dl.espressif.com/pypi/future/future-0.18.2.tar.gz (829 kB)
     |████████████████████████████████| 829 kB 16.8 MB/s 
Collecting cryptography>=2.1.4
  Downloading https://dl.espressif.com/pypi/cryptography/cryptography-3.4.7-cp36-abi3-manylinux2014_x86_64.whl (3.2 MB)
     |████████████████████████████████| 3.2 MB 2.4 MB/s 
Collecting pyparsing<2.4.0,>=2.0.3
  Downloading https://dl.espressif.com/pypi/pyparsing/pyparsing-2.3.1-py2.py3-none-any.whl (61 kB)
     |████████████████████████████████| 61 kB 69 kB/s 
Collecting pyelftools>=0.22
  Downloading https://dl.espressif.com/pypi/pyelftools/pyelftools-0.27-py2.py3-none-any.whl (151 kB)
     |████████████████████████████████| 151 kB 15.6 MB/s 
Collecting gdbgui==0.13.2.0
  Downloading https://dl.espressif.com/pypi/gdbgui/gdbgui-0.13.2.0-py3-none-any.whl (878 kB)
     |████████████████████████████████| 878 kB 16.2 MB/s 
Collecting pygdbmi<=0.9.0.2
  Downloading https://dl.espressif.com/pypi/pygdbmi/pygdbmi-0.9.0.2-py3-none-any.whl (16 kB)
Collecting python-socketio<5
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/b2/91/d78afbe5861de53cafe9dcc6eb1a802d5495cfbffb79b8385ee7cf15a71c/python_socketio-4.6.1-py2.py3-none-any.whl (51 kB)
Collecting kconfiglib==13.7.1
  Downloading https://dl.espressif.com/pypi/kconfiglib/kconfiglib-13.7.1-py2.py3-none-any.whl (145 kB)
     |████████████████████████████████| 145 kB 16.8 MB/s 
Collecting reedsolo<=1.5.4,>=1.5.3
  Downloading https://dl.espressif.com/pypi/reedsolo/reedsolo-1.5.4.tar.gz (271 kB)
     |████████████████████████████████| 271 kB 17.1 MB/s 
Collecting bitstring>=3.1.6
  Downloading https://dl.espressif.com/pypi/bitstring/bitstring-3.1.7.tar.gz (195 kB)
     |████████████████████████████████| 195 kB 16.4 MB/s 
Collecting ecdsa>=0.16.0
  Downloading https://dl.espressif.com/pypi/ecdsa/ecdsa-0.17.0-py2.py3-none-any.whl (119 kB)
     |████████████████████████████████| 119 kB 13.3 MB/s 
Collecting construct==2.10.54
  Downloading https://dl.espressif.com/pypi/construct/construct-2.10.54.tar.gz (55 kB)
     |████████████████████████████████| 55 kB 761 kB/s 
Collecting Pygments<3.0,>=2.2.0
  Downloading https://dl.espressif.com/pypi/pygments/Pygments-2.9.0-py3-none-any.whl (1.0 MB)
     |████████████████████████████████| 1.0 MB 2.2 MB/s 
Collecting Flask-Compress<2.0,>=1.4.0
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/75/fa/a3c96f3f367ad1d6532fa8394c9a6f5879513868207096f6b41f4168b342/Flask_Compress-1.10.1-py3-none-any.whl (7.9 kB)
Collecting Flask-SocketIO<3.0,>=2.9
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/cd/70/ae4a055477ecad475eec4990eb3474b152ff525ed10690afdcf180aee06c/Flask_SocketIO-2.9.6-py2.py3-none-any.whl (16 kB)
Collecting gevent<2.0,>=1.2.2
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/a9/95/b53b78b15abbe547bed7381ca9c8319c86d6b646a30d0831e26c307a5fa7/gevent-1.5.0-cp36-cp36m-manylinux2010_x86_64.whl (5.1 MB)
Collecting Flask<1.0,>=0.12.2
  Downloading https://dl.espressif.com/pypi/flask/Flask-0.12.5-py2.py3-none-any.whl (81 kB)
     |████████████████████████████████| 81 kB 681 kB/s 
Collecting importlib-metadata
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/23/5d/f2151217058e7d5c5b4b584bc6052c2ae478c5a36b58a056364351613bfb/importlib_metadata-4.5.0-py3-none-any.whl (17 kB)
Collecting cffi>=1.12
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/2b/cf/9a3b04e57191a970836aeaa8b2075574f02fbdb65d6368457a2f13213e7f/cffi-1.14.5-cp36-cp36m-manylinux1_x86_64.whl (401 kB)
Collecting six>=1.9.0
  Downloading https://dl.espressif.com/pypi/six/six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting python-engineio<4,>=3.13.0
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/8d/35/b9edf38b6a42077f3c097ab4edb0281adb3cc5434645c0bd301b0b45c767/python_engineio-3.14.2-py2.py3-none-any.whl (51 kB)
Collecting pycparser
  Downloading https://dl.espressif.com/pypi/pycparser/pycparser-2.20-py2.py3-none-any.whl (112 kB)
     |████████████████████████████████| 112 kB 1.2 MB/s 
Collecting itsdangerous>=0.21
  Downloading https://dl.espressif.com/pypi/itsdangerous/itsdangerous-2.0.1-py3-none-any.whl (18 kB)
Collecting Werkzeug<1.0,>=0.7
  Downloading https://dl.espressif.com/pypi/werkzeug/Werkzeug-0.16.1-py2.py3-none-any.whl (327 kB)
     |████████████████████████████████| 327 kB 2.2 MB/s 
Collecting Jinja2>=2.4
  Downloading https://dl.espressif.com/pypi/jinja2/Jinja2-3.0.1-py3-none-any.whl (133 kB)
     |████████████████████████████████| 133 kB 19.5 MB/s 
Collecting brotli
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/b4/d3/7c98f05b7b9103e2f3a112ba42f269c798155b3e5404fb80bb8f823aaebe/Brotli-1.0.9-cp36-cp36m-manylinux1_x86_64.whl (357 kB)
Collecting greenlet>=0.4.14
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/54/8f/ab5a5487a4b1e52638bc34c3e233796149830c3e817664b669712e6cfa2d/greenlet-1.1.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (155 kB)
Collecting MarkupSafe>=2.0
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/08/dc/a5ed54fcc61f75343663ee702cbf69831dcec9b1a952ae21cf3d1fbc56ba/MarkupSafe-2.0.1-cp36-cp36m-manylinux2010_x86_64.whl (30 kB)
Collecting zipp>=0.5
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/0f/8c/715c54e9e34c0c4820f616a913a7de3337d0cd79074dd1bed4dd840f16ae/zipp-3.4.1-py3-none-any.whl (5.2 kB)
Collecting typing-extensions>=3.6.4
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/2e/35/6c4fff5ab443b57116cb1aad46421fb719bed2825664e8fe77d66d99bcbc/typing_extensions-3.10.0.0-py3-none-any.whl (26 kB)
Building wheels for collected packages: construct, future, reedsolo, bitstring
  Building wheel for construct (setup.py) ... done
  Created wheel for construct: filename=construct-2.10.54-py3-none-any.whl size=57415 sha256=b2a7cdb64477fd368053d46190c3691128dbf6235c79d87b25274485c50bdf5c
  Stored in directory: /home/ly/.cache/pip/wheels/37/81/ef/0c967993638ff9e63c1fc64d2d5ad642423725e9bc4e8654d2
  Building wheel for future (setup.py) ... done
  Created wheel for future: filename=future-0.18.2-py3-none-any.whl size=491070 sha256=5dd44c9591dd314e2faf7f562aa49923685952fc21311c7a5f83c101e3c06be9
  Stored in directory: /home/ly/.cache/pip/wheels/b0/90/b9/8e9016015757036b38d5c6d5c1c17e81e4ee84133ca1e112a0
  Building wheel for reedsolo (setup.py) ... done
  Created wheel for reedsolo: filename=reedsolo-1.5.4-py3-none-any.whl size=28970 sha256=6682c1c32f864215bb1e3b9d3e4924fbd5aa10829b1408ec16e647061988091e
  Stored in directory: /home/ly/.cache/pip/wheels/ea/38/67/7570de9e7cab0421f6eeff56d7dccb039b33ae5dd1e45f6f56
  Building wheel for bitstring (setup.py) ... done
  Created wheel for bitstring: filename=bitstring-3.1.7-py3-none-any.whl size=37961 sha256=1d16343cab4249d6605e682a266822d4a5f07a75b2b64aea68ff68124731d1cd
  Stored in directory: /home/ly/.cache/pip/wheels/3e/bc/e6/413f77a118cfbffa8d935ad34884a5aea61da38686d1234e0c
Successfully built construct future reedsolo bitstring
Installing collected packages: zipp, typing-extensions, six, MarkupSafe, importlib-metadata, Werkzeug, python-engineio, Jinja2, itsdangerous, click, python-socketio, pycparser, greenlet, Flask, brotli, Pygments, pygdbmi, gevent, Flask-SocketIO, Flask-Compress, cffi, reedsolo, pyserial, pyparsing, pyelftools, kconfiglib, gdbgui, future, ecdsa, cryptography, construct, bitstring
Successfully installed Flask-0.12.5 Flask-Compress-1.10.1 Flask-SocketIO-2.9.6 Jinja2-3.0.1 MarkupSafe-2.0.1 Pygments-2.9.0 Werkzeug-0.16.1 bitstring-3.1.7 brotli-1.0.9 cffi-1.14.5 click-8.0.1 construct-2.10.54 cryptography-3.4.7 ecdsa-0.17.0 future-0.18.2 gdbgui-0.13.2.0 gevent-1.5.0 greenlet-1.1.0 importlib-metadata-4.5.0 itsdangerous-2.0.1 kconfiglib-13.7.1 pycparser-2.20 pyelftools-0.27 pygdbmi-0.9.0.2 pyparsing-2.3.1 pyserial-3.5 python-engineio-3.14.2 python-socketio-4.6.1 reedsolo-1.5.4 six-1.16.0 typing-extensions-3.10.0.0 zipp-3.4.1
All done! You can now run:

  . ./export.sh

出现. ./export.sh就说明安装成功了。

4.2 执行. ./export.sh 

(tensorflow-gpu) ly@ly-MS-7B51:~/esp/esp-idf$ . ./export.sh
Detecting the Python interpreter
Checking "python" ...
Python 3.6.10 :: Anaconda, Inc.
"python" has been detected
Adding ESP-IDF tools to PATH...
Not using an unsupported version of tool xtensa-esp32-elf found in PATH: 1.22.0-80-g6c4433a-5.2.0.
Using Python interpreter in /home/ly/.espressif/python_env/idf4.4_py3.6_env/bin/python
Checking if Python packages are up to date...
Python requirements from /home/ly/esp/esp-idf/requirements.txt are satisfied.
Added the following directories to PATH:
  /home/ly/esp/esp-idf/components/esptool_py/esptool
  /home/ly/esp/esp-idf/components/espcoredump
  /home/ly/esp/esp-idf/components/partition_table
  /home/ly/esp/esp-idf/components/app_update
  /home/ly/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin
  /home/ly/.espressif/tools/xtensa-esp32s2-elf/esp-2020r3-8.4.0/xtensa-esp32s2-elf/bin
  /home/ly/.espressif/tools/xtensa-esp32s3-elf/esp-2020r3-8.4.0/xtensa-esp32s3-elf/bin
  /home/ly/.espressif/tools/riscv32-esp-elf/1.24.0.123_64eb9ff-8.4.0/riscv32-esp-elf/bin
  /home/ly/.espressif/tools/esp32ulp-elf/2.28.51-esp-20191205/esp32ulp-elf-binutils/bin
  /home/ly/.espressif/tools/esp32s2ulp-elf/2.28.51-esp-20191205/esp32s2ulp-elf-binutils/bin
  /home/ly/.espressif/tools/openocd-esp32/v0.10.0-esp32-20210401/openocd-esp32/bin
  /home/ly/.espressif/python_env/idf4.4_py3.6_env/bin
  /home/ly/esp/esp-idf/tools
Done! You can now compile ESP-IDF projects.
Go to the project directory and run:

  idf.py build

出现  idf.py build 说明 执行成功

5. 执行例程

5.1将hello_world例程放到自己想要保存的位置,hello_world例程位置如下:

exp-idf/examples/get-started/hello_world/

然后,进入 hello_world目录下:

cd hello_world

5.2执行命令,选择芯片

idf.py set-target esp32

如果出现

(tensorflow-gpu) ly@ly-MS-7B51:~/文档/hyh/esp32_code/hello_world$ idf.py set-target esp32s
idf.py:未找到命令

执行下面命令即可,可能是因为环境变量没有配置好,按照前面的命令重新配置一下即可

. $IDF_PATH/export.sh

5.3 配置工程

idf.py menuconfig

5.4  编译

idf.py build

5.5下载

idf.py -p /dev/ttyUSB0 flash

如果出现

Serial port /dev/ttyUSB0
Traceback (most recent call last):
  File "/home/zhouyun/.espressif/python_env/idf4.2_py3.8_env/lib/python3.8/site-packages/serial/serialposix.py", line 265, in open
    self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
PermissionError: [Errno 13] Permission denied: '/dev/ttyUSB0'

说明当前用户没有对串口的读写权限,增加串口的读写权限即可:

sudo chmod a=rw /dev/ttyUSB0

下载成功的日志如下:

(tensorflow-gpu) ly@ly-MS-7B51:~/文档/hyh/esp32_code/hello_world$ idf.py -p /dev/ttyUSB0 flash
Executing action: flash
Running ninja in directory /home/ly/文档/hyh/esp32_code/hello_world/build
Executing "ninja flash"...
[2/5] cd /home/ly/文档/hyh/esp32_cod...code/hello_world/build/hello-world.bin
hello-world.bin binary size 0x27e90 bytes. Smallest app partition is 0x100000 bytes. 0xd8170 bytes (84%) free.
[2/5] Performing build step for 'bootloader'
[1/1] cd /home/ly/文档/hyh/esp32_code/hello_world/build/bootloader/esp-idf/esptool_py && /home/ly/.espressif/python_env/idf4.4_py3.6_env/bin/python /home/ly/esp/esp-idf/components/partition_table/check_sizes.py --offset 0x8000 bootloader 0x1000 /home/ly/文档/hyh/esp32_code/hello_world/build/bootloader/bootloader.bin
Bootloader binary size 0x60d0 bytes. 0xf30 bytes (16%) free.
[3/3] cd /home/ly/esp/esp-idf/componen...nents/esptool_py/run_serial_tool.cmake
esptool.py esp32 -p /dev/ttyUSB0 -b 460800 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 40m --flash_size 2MB 0x1000 bootloader/bootloader.bin 0x10000 hello-world.bin 0x8000 partition_table/partition-table.bin
esptool.py v3.1-dev
Serial port /dev/ttyUSB0
Connecting........_____....._____.
Chip is ESP32-D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 7c:9e:bd:f2:83:cc
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Flash will be erased from 0x00001000 to 0x00007fff...
Flash will be erased from 0x00010000 to 0x00037fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Compressed 24784 bytes to 15367...
Writing at 0x00001000... (100 %)
Wrote 24784 bytes (15367 compressed) at 0x00001000 in 0.7 seconds (effective 267.1 kbit/s)...
Hash of data verified.
Compressed 163472 bytes to 86238...
Writing at 0x00010000... (16 %)
Writing at 0x0001aa8a... (33 %)
Writing at 0x0002027d... (50 %)
Writing at 0x00025993... (66 %)
Writing at 0x0002d9ba... (83 %)
Writing at 0x00036520... (100 %)
Wrote 163472 bytes (86238 compressed) at 0x00010000 in 2.3 seconds (effective 577.7 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 103...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (103 compressed) at 0x00008000 in 0.1 seconds (effective 407.1 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
Done

5.6 使用monitor查看运行情况

idf.py -p /dev/ttyUSB0 monitor

之后,使用  ctrl + ] 退出串口monitor即可

6.参考链接

最后,非常感谢这些博主的记录

https://blog.csdn.net/zhypss/article/details/109398455

https://blog.csdn.net/xh870189248/article/details/80208099

https://blog.csdn.net/LSQ_L/article/details/109861332

https://zhuanlan.zhihu.com/p/345308267

https://www.cnblogs.com/gulan-zmc/p/11992359.html

https://blog.csdn.net/p1279030826/article/details/113545095

猜你喜欢

转载自blog.csdn.net/guaizaiguaizai/article/details/118066233