Page 1 of 1

WSL2+VSCODE+ESP-IDF刷写问题

Posted: Sun Jul 17, 2022 1:09 pm
by eddy007
系统为WIN11专业版,板子为ESP32-S3-WROOM-1,通过340C连接到RX,TX。Arduino下可以正常刷写。
在WSL2+ubuntu+vscode+esp-idf环境中,编译example中的hello world通过,刷写的时候选择ESP32-S3(Built-in USB JTAG)、UART模式,提示错误:

> Executing task: powershell.exe -Command "python \\\\wsl.localhost\\Ubuntu\\home\\eddy\\esp\\esp-idf\\components\\esptool_py\\esptool\\esptool.py -p COM3 -b 460800 --before default_reset --after hard_reset --chip esp32s3 write_flash --flash_mode dio --flash_freq 80m --flash_size detect 0x10000 hello_world.bin 0x0 bootloader\bootloader.bin 0x8000 partition_table\partition-table.bin" <

终端进程“/usr/bin/bash '-c', 'powershell.exe -Command "python \\\\wsl.localhost\\Ubuntu\\home\\eddy\\esp\\esp-idf\\components\\esptool_py\\esptool\\esptool.py -p COM3 -b 460800 --before default_reset --after hard_reset --chip esp32s3 write_flash --flash_mode dio --flash_freq 80m --flash_size detect 0x10000 hello_world.bin 0x0 bootloader\bootloader.bin 0x8000 partition_table\partition-table.bin"'”已终止,退出代码: 1。

这是为什么呢?请大神教教我,谢谢~

Re: WSL2+VSCODE+ESP-IDF刷写问题

Posted: Tue Jul 19, 2022 8:49 am
by ESP_ICY
尝试一下删除工程中 build 文件夹和 sdkconfig 文件后再选择芯片类型并编译。如果还不行,删除 build 和 sdkconfig 后,直接在系统终端进行目标芯片设置试试可不可以。

Re: WSL2+VSCODE+ESP-IDF刷写问题

Posted: Wed Aug 10, 2022 3:31 am
by hotbubblesnake
请问问题解决了吗?我似乎碰到一样的问题。似乎是在WSL2环境下ESP-IDF使用了错误的Python。

WSL2+Ubuntu+terminal+ESP-IDF:
能编译能刷版能运行。

WSL2+Ubuntu+vscode+ESP-IDF:
能编译,刷固件出错,在运行esptool.py的时候vscode尝试从Windows环境中找Python。但vscode打开的是bash,ESP32板已经用usbipd接到了WSL里面的/dev/ttyUSB0。我装了Python后又找其他的module:

Code: Select all

 *  Executing task: /home/myaccount/.espressif/python_env/idf4.4_py3.8_env/bin/python /home/myaccount/esp/esp-idf/tools/idf_size.py /home/myaccount/esp/uart_async_rxtxtasks/build/uart_async_rxtxtasks.map 

Total sizes:
Used static DRAM:   11352 bytes ( 169384 remain, 6.3% used)
      .data size:    9064 bytes
      .bss  size:    2288 bytes
Used static IRAM:   49486 bytes (  81586 remain, 37.8% used)
      .text size:   48459 bytes
   .vectors size:    1027 bytes
Used Flash size :  137551 bytes
      .text     :   98995 bytes
      .rodata   :   38300 bytes
Total image size:  196101 bytes (.bin may be padded larger)

 *  Executing task: powershell.exe -Command "python \\\\wsl.localhost\\Ubuntu\\home\\myaccount\\esp\\esp-idf\\components\\esptool_py\\esptool\\esptool.py -p /dev/ttyUSB0 -b 460800 --before default_reset --after hard_reset --chip esp32 write_flash --flash_mode dio --flash_freq 40m --flash_size detect 0x10000 uart_async_rxtxtasks.bin 0x1000 bootloader\bootloader.bin 0x8000 partition_table\partition-table.bin" 

Pyserial is not installed for C:\Users\myaccount\AppData\Local\Programs\Python\Python38\python.exe. Check the README for installation instructions.
Traceback (most recent call last):
  File "\\wsl.localhost\Ubuntu\home\myaccount\esp\esp-idf\components\esptool_py\esptool\esptool.py", line 27, in <module>
    import serial
ModuleNotFoundError: No module named 'serial'

 *  The terminal process "/usr/bin/bash '-c', 'powershell.exe -Command "python \\\\wsl.localhost\\Ubuntu\\home\\myaccount\\esp\\esp-idf\\components\\esptool_py\\esptool\\esptool.py -p /dev/ttyUSB0 -b 460800 --before default_reset --after hard_reset --chip esp32 write_flash --flash_mode dio --flash_freq 40m --flash_size detect 0x10000 uart_async_rxtxtasks.bin 0x1000 bootloader\bootloader.bin 0x8000 partition_table\partition-table.bin"'" terminated with exit code: 1.
是不是什么环境设置错误?