本文主要是介绍鹏程万里------esp32 开发编译和烧录,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
首先编译demo
打开C:\msys32目录下的mingw32.exe然后执行下面的操作
DZ0012+Administrator@DZ0012 MINGW32 ~
# cd ..
DZ0012+Administrator@DZ0012 MINGW32 /home
# ls
Administrator
DZ0012+Administrator@DZ0012 MINGW32 /home
# cd ..
DZ0012+Administrator@DZ0012 MINGW32 /
# ls
autorebase.bat hello_world mingw32.ini network.xml
autorebasebase1st.bat home mingw64 opt
bin InstallationLog.txt mingw64.exe proc
components.xml maintenancetool.dat mingw64.ini tmp
dev maintenancetool.exe msys2.exe usr
dir maintenancetool.ini msys2.ico var
esp mingw32 msys2.ini
etc mingw32.exe msys2_shell.cmd
DZ0012+Administrator@DZ0012 MINGW32 /
# cd esp/
DZ0012+Administrator@DZ0012 MINGW32 /esp
# ls
esp-idf
DZ0012+Administrator@DZ0012 MINGW32 /esp
# cd esp-idf/
DZ0012+Administrator@DZ0012 MINGW32 /esp/esp-idf
# ls
add_path.sh CONTRIBUTING.rst Kconfig README.md tools
CMakeLists.txt docs LICENSE requirements.txt
components examples make sdkconfig.rename
DZ0012+Administrator@DZ0012 MINGW32 /esp/esp-idf
# cd examples/
DZ0012+Administrator@DZ0012 MINGW32 /esp/esp-idf/examples
# ls
bluetooth ethernet peripherals README.md wifi
build_system get-started protocols storage
common_components mesh provisioning system
DZ0012+Administrator@DZ0012 MINGW32 /esp/esp-idf/examples
# cd get-started/
DZ0012+Administrator@DZ0012 MINGW32 /esp/esp-idf/examples/get-started
# ls
blink hello_world README.md
DZ0012+Administrator@DZ0012 MINGW32 /esp/esp-idf/examples/get-started
# make
make: *** 没有指明目标并且找不到 makefile。 停止。
DZ0012+Administrator@DZ0012 MINGW32 /esp/esp-idf/examples/get-started
# cd hello_world/
DZ0012+Administrator@DZ0012 MINGW32 /esp/esp-idf/examples/get-started/hello_worl d
# make
DZ0012+Administrator@DZ0012 MINGW32 /esp/esp-idf/examples/get-started/hello_worl d
# ls
build CMakeLists.txt main Makefile README.md sdkconfig sdkconfig.old
DZ0012+Administrator@DZ0012 MINGW32 /esp/esp-idf/examples/get-started/hello_worl d
# make
Toolchain path: /opt/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
WARNING: Toolchain version is not supported: crosstool-ng-1.22.0-80-g6c4433a5
Expected to see version: esp32-2019r1
Please check ESP-IDF setup instructions and update the toolchain, or proceed at your own risk.
WARNING: Compiler version is not supported: 5.2.0
Expected to see version(s): 8.2.0
Please check ESP-IDF setup instructions and update the toolchain, or proceed at your own risk.
Python requirements from C:/msys32/esp/esp-idf/requirements.txt are satisfied.
WARNING: Toolchain version is not supported: crosstool-ng-1.22.0-80-g6c4433a5
Expected to see version: esp32-2019r1
Please check ESP-IDF setup instructions and update the toolchain, or proceed at your own risk.
WARNING: Compiler version is not supported: 5.2.0
Expected to see version(s): 8.2.0
Please check ESP-IDF setup instructions and update the toolchain, or proceed at your own risk.
App "hello-world" version: v4.0-dev-837-g58df1d93b-dirty
To flash all build output, run 'make flash' or:
python /esp/esp-idf/components/esptool_py/esptool/esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 115200 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0x1000 /esp/esp-idf/examples/get-started/hello_world/build/bootloader/bootloader.bin 0x10000 /esp/esp-idf/examples/get-started/hello_world/build/hello-world.bin 0x8000 /esp/esp-idf/examples/get-started/hello_world/build/partitions_singleapp.bin
然后烧录
DZ0012+Administrator@DZ0012 MINGW32 /esp/esp-idf/examples/get-started/hello_world
# make flash
Toolchain path: /opt/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
WARNING: Toolchain version is not supported: crosstool-ng-1.22.0-80-g6c4433a5
Expected to see version: esp32-2019r1
Please check ESP-IDF setup instructions and update the toolchain, or proceed at your own risk.
WARNING: Compiler version is not supported: 5.2.0
Expected to see version(s): 8.2.0
Please check ESP-IDF setup instructions and update the toolchain, or proceed at your own risk.
Python requirements from C:/msys32/esp/esp-idf/requirements.txt are satisfied.
WARNING: Toolchain version is not supported: crosstool-ng-1.22.0-80-g6c4433a5
Expected to see version: esp32-2019r1
Please check ESP-IDF setup instructions and update the toolchain, or proceed at your own risk.
WARNING: Compiler version is not supported: 5.2.0
Expected to see version(s): 8.2.0
Please check ESP-IDF setup instructions and update the toolchain, or proceed at your own risk.
App "hello-world" version: v4.0-dev-837-g58df1d93b-dirty
Flashing binaries to serial port /dev/ttyUSB0 (app at offset 0x10000)...
esptool.py v2.7-dev
Serial port C:/msys32/dev/ttyUSB0
Traceback (most recent call last):
File "C:/msys32/esp/esp-idf/components/esptool_py/esptool/esptool.py", line 3065, in <module>
_main()
File "C:/msys32/esp/esp-idf/components/esptool_py/esptool/esptool.py", line 3058, in _main
main()
File "C:/msys32/esp/esp-idf/components/esptool_py/esptool/esptool.py", line 2756, in main
esp = chip_class(each_port, initial_baud, args.trace)
File "C:/msys32/esp/esp-idf/components/esptool_py/esptool/esptool.py", line 225, in __init__
self._port = serial.serial_for_url(port)
File "C:/msys32/mingw32/lib/python2.7/site-packages/serial/__init__.py", line 88, in serial_for_url
instance.open()
File "C:/msys32/mingw32/lib/python2.7/site-packages/serial/serialwin32.py", line 62, in open
raise SerialException("could not open port {!r}: {!r}".format(self.portstr, ctypes.WinError()))
serial.serialutil.SerialException: could not open port 'C:/msys32/dev/ttyUSB0': WindowsError(2, '\xcf\xb5\xcd\xb3\xd5\xd2\xb2\xbb\xb5\xbd\xd6\xb8\xb6\xa8\xb5\xc4\xce\xc4\xbc\xfe\xa1\xa3')
make: *** [/esp/esp-idf/components/esptool_py/Makefile.projbuild:67:flash] 错误 1
出错了。。。。。
看了以下端口号
DZ0012+Administrator@DZ0012 MINGW32 ~
# cd dev
-bash: cd: dev: No such file or directory
DZ0012+Administrator@DZ0012 MINGW32 ~
# cd /dev
DZ0012+Administrator@DZ0012 MINGW32 /dev
# ls
clipboard dsp null random sda3 sda7 stdin urandom
conin fd ptmx sda sda4 sda8 stdout windows
conout full pty0 sda1 sda5 shm tty zero
console mqueue pty1 sda2 sda6 stderr ttyS12
DZ0012+Administrator@DZ0012 MINGW32 /dev
结果是 ttyS12
于是make menuconfig修改串口
选这个进去
然后
选第一个修改
改成自己的
然后再次make
make flash
DZ0012+Administrator@DZ0012 MINGW32 /esp/esp-idf/examples/get-started/hello_world
# make flash
Toolchain path: /opt/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
WARNING: Toolchain version is not supported: crosstool-ng-1.22.0-80-g6c4433a5
Expected to see version: esp32-2019r1
Please check ESP-IDF setup instructions and update the toolchain, or proceed at your own risk.
WARNING: Compiler version is not supported: 5.2.0
Expected to see version(s): 8.2.0
Please check ESP-IDF setup instructions and update the toolchain, or proceed at your own risk.
Python requirements from C:/msys32/esp/esp-idf/requirements.txt are satisfied.
WARNING: Toolchain version is not supported: crosstool-ng-1.22.0-80-g6c4433a5
Expected to see version: esp32-2019r1
Please check ESP-IDF setup instructions and update the toolchain, or proceed at your own risk.
WARNING: Compiler version is not supported: 5.2.0
Expected to see version(s): 8.2.0
Please check ESP-IDF setup instructions and update the toolchain, or proceed at your own risk.
App "hello-world" version: v4.0-dev-837-g58df1d93b-dirty
Flashing binaries to serial port /dev/ttyS12 (app at offset 0x10000)...
esptool.py v2.7-dev
Serial port /??/COM13
Traceback (most recent call last):
File "C:/msys32/esp/esp-idf/components/esptool_py/esptool/esptool.py", line 3065, in <module>
_main()
File "C:/msys32/esp/esp-idf/components/esptool_py/esptool/esptool.py", line 3058, in _main
main()
File "C:/msys32/esp/esp-idf/components/esptool_py/esptool/esptool.py", line 2756, in main
esp = chip_class(each_port, initial_baud, args.trace)
File "C:/msys32/esp/esp-idf/components/esptool_py/esptool/esptool.py", line 225, in __init__
self._port = serial.serial_for_url(port)
File "C:/msys32/mingw32/lib/python2.7/site-packages/serial/__init__.py", line 88, in serial_for_url
instance.open()
File "C:/msys32/mingw32/lib/python2.7/site-packages/serial/serialwin32.py", line 62, in open
raise SerialException("could not open port {!r}: {!r}".format(self.portstr, ctypes.WinError()))
serial.serialutil.SerialException: could not open port '/??/COM13': WindowsError(123, '\xce\xc4\xbc\xfe\xc3\xfb\xa1\xa2\xc4\xbf\xc2\xbc\xc3\xfb\xbb\xf2\xbe\xed\xb1\xea\xd3\xef\xb7\xa8\xb2\xbb\xd5\xfd\xc8\xb7\xa1\xa3')
make: *** [/esp/esp-idf/components/esptool_py/Makefile.projbuild:67:flash] 错误 1
看起来先装个gcc在windows上
参考https://blog.csdn.net/rong_toa/article/details/79002711
但是安装gcc遇到了
参考https://www.cnblogs.com/indif/archive/2011/04/18/2019688.html
原来是我安装了webstorm的愿意
然后安装后在桌面出现
双击打开
选中所有然后点击installation里的apply安装
然后到环境变量中把C:\MinGW\bin加入path
gcc是安装好了
但是用makeflash始终失败,不得已只能用flash烧录工具
搞定
这篇关于鹏程万里------esp32 开发编译和烧录的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!