Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用VScode ESP-IDF插件烧录程序出现问题 (VSC-1596) #1437

Open
1 task done
XiaPeng1012 opened this issue Feb 20, 2025 · 13 comments · May be fixed by #1450
Open
1 task done

使用VScode ESP-IDF插件烧录程序出现问题 (VSC-1596) #1437

XiaPeng1012 opened this issue Feb 20, 2025 · 13 comments · May be fixed by #1450
Assignees
Labels
bug-report Bug Report from users on Github (don't use this tag manually, its supposed to be used via the issue)

Comments

@XiaPeng1012
Copy link

XiaPeng1012 commented Feb 20, 2025

OS

Windows

Operating System version

windows 11

Visual Studio Code version

1.97.2

ESP-IDF version

5.3.2

Python version

3.11.2

Doctor command output

d:\Software\ESP\tools\tools\openocd-esp32\v0.12.0-esp32-20241016\openocd-esp32\bin\openocd.exe

Open On-Chip Debugger v0.12.0-esp32-20241016 (2024-10-16-14:17)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html

d:\Software\ESP\tools\tools\openocd-esp32\v0.12.0-esp32-20241016\openocd-esp32\bin\openocd.exe

[OpenOCD]
Open On-Chip Debugger v0.12.0-esp32-20241016 (2024-10-16-14:17)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html

debug_level: 2

Info : only one transport option;
autoselecting 'jtag'
Info : esp_usb_jtag: VID set to 0x303a and PID to 0x1001
Info : esp_usb_jtag: capabilities descriptor set to 0x2000

Info : Listening on port 6666 for tcl conn
ections
Info : Listening on port 4444 for telnet connections

Info : esp_usb_jtag: serial (A0:85:E3:
FD:BE:74)
Info : esp_usb_jtag: Device found. Base speed 40000KHz, div range 1 to 255
Info : clock speed 40000 kHz

Info : JTAG tap: esp32s3.ta
p0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32s3.tap1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)

Info : [esp32s3.cpu0] Examinatio
n succeed

Info : [esp32s3.cpu1] Examination succ
eed
Info : [esp32s3.cpu0] starting gdb server on 3333
Info : Listening on port 3333 for gdb connections

Info : [esp32s3.cpu0] Target halted, PC=0x40376207, debug_reason=00000000

Info : [esp32s3.cpu0] Reset ca
use (3) - (Software core reset)
Info : Set GDB target to 'esp32s3.cpu0'

Info : [esp32s3.cpu1] Target halted, PC=0x40000400, debug_reason=00000000

Info : [esp32s3.cpu1] Reset cau
se (3) - (Software core reset)

Info : accepting 'tcl' connection on tcp/6666
Info : dropped 'tcl' connection

Info : accepting 'tcl' connection on tcp/6666
ready

Flashing "e:/Project/2025/Wireless_Tool/wireless_tool/build/bootloader/bootloader.bin" at 0x0

** program_esp input args <0x0 verify> **

Info : JTAG tap: esp32s3.tap0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32s3.tap1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)

Info : [esp32s3.cpu0] requesting target halt and execut
ing a soft reset

Info : [esp32s3.cpu0] Debug controller was reset.

Info : [esp32s3.cpu0] Core was reset.

Info : [esp32s3.cpu0] Target halted, PC=0x500000EF
, debug_reason=00000000

Info : [esp32s3.cpu0] Reset cause (3)

  • (Software core reset)

Info : [esp32s3.cpu0] Core
was reset.

Info : [esp32s3.cpu0] Target halted, PC
=0x40000400, debug_reason=00000000
Info : [esp32s3.cpu1] Debug controller was res
et.
Info : [esp32s3.cpu1] Core was reset.

Info : [esp32s3.cpu1] Target halted,
PC=0x40000400, debug_reason=00000000

Info : [esp32s3.cpu1] Reset cause (3) - (Software core reset)

Info : [esp32s3.cpu0] Reset cause (3
) - (Software core reset)

** Programming Started **

Info : [esp32s3.cpu0] Target halted, PC=0x4038CB86, deb
ug_reason=00000001

Info : Flash mapping 0: 0x10020 -> 0x3
c0e0020, 212 KB
Info : Flash mapping 1: 0x50020 -> 0x42000020, 867 KB
Info : Auto-detected flash bank 'esp32s3.cpu0.flash' size 16384 KB
Info : Using flash bank 'esp32s3.cpu0.flash' size 16384 KB

❌ Error: timed out while waiting for target halted

Info : [esp32s3.cpu0] T
arget halted, PC=0x40376207, debug_reason=00000000

❌ Error: [esp32s3.cpu0] not halted 0, pc 0x40376207, ps 0x60623
Error: Failed to wait algorithm (-302)!
Error: Algorithm run failed (-302)!

❌ Error: Failed to run flasher stub (-302)!

** Flashing Failed **
-1

[/OpenOCD]
[Flash]
Failed to flash the device (JTag), please try again [got response: '-1', expecting: '0']

Extension

No response

Description

第一次烧录程序正常,在进行第二次程序烧录后烧录异常,使用的VSCode烧录方式为JTAG烧录。
Image

经过测试发现,烧录程序小于某一个大小的时候多次烧录不会出现问题,当程序大小大于某一个范围的时候,多次烧录程序就会异常,在程序烧录异常后,手动擦除程序flash数据后,首次使用jtag方式烧录程序不会出现问题。在JTAG烧录程序发生异常的时候,使用UART烧录方式能够进行正常程序烧录。

Debug Message

NULL

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@XiaPeng1012 XiaPeng1012 added the bug-report Bug Report from users on Github (don't use this tag manually, its supposed to be used via the issue) label Feb 20, 2025
@github-actions github-actions bot changed the title 使用VScode ESP-IDF插件烧录程序出现问题 使用VScode ESP-IDF插件烧录程序出现问题 (VSC-1596) Feb 20, 2025
@brianignacio5
Copy link
Collaborator

@gerekon Could you please take a look ?

@erhankur
Copy link

@XiaPeng1012 Could you please share the verbose OpenOCD logs. You can append below commands to the and of config script.

-c "esp stub_log on" -d3 -l log.txt

@gerekon
Copy link
Collaborator

gerekon commented Feb 20, 2025

@XiaPeng1012 Can I ask you to try flashing using command line?

openocd -f board/esp32s3-builtin.cfg -d3 -l ocd.log -c 'init; program_esp_bins e:/Project/2025/Wireless_Tool/wireless_tool/build flasher_args.json'.

And then attach produced ocd.log here.

@XiaPeng1012
Copy link
Author

XiaPeng1012 commented Feb 21, 2025

@XiaPeng1012我可以请您尝试使用命令行进行刷新吗?

openocd -f board/esp32s3-builtin.cfg -d3 -l ocd.log -c 'init; program_esp_bins e:/Project/2025/Wireless_Tool/wireless_tool/build flasher_args.json'

然后将制作的附加ocd.log到这里。

@gerekon 您好,我已经按照您的说明进行操作,我现将ocd.log作为附件添加。

ocd.log

@XiaPeng1012
Copy link
Author

@XiaPeng1012 Could you please share the verbose OpenOCD logs. You can append below commands to the and of config script.

-c "esp stub_log on" -d3 -l log.txt

@erhankur 您好,我已经按照gerkon的方式生成了OpenOCD的 log,现在将生成的日志以附件的形式发送给您。

ocd.log

@erhankur
Copy link

@XiaPeng1012 I don't see the stub logs here. Please add -c "esp stub_log on" -d3 -l log.txt

@XiaPeng1012
Copy link
Author

@XiaPeng1012 I don't see the stub logs here. Please add -c "esp stub_log on" -d3 -l log.txt

@erhankur 抱歉,我可能不知道如何添加-c "esp stub_log on" -d3 -l log.txt,你能告诉我更为详细的添加方式么

@erhankur
Copy link

You can open your project’s .vscode/settings.json and add or modify:

{
  "idf.openOcdLaunchArgs": [
      "-c",
      "init",
      "-c",
      "reset halt",
      "-c",
      "esp stub_log on",
      "-d3",
      "-l log.txt"
  ]
}

@XiaPeng1012
Copy link
Author

You can open your project’s .vscode/settings.json and add or modify:

{
  "idf.openOcdLaunchArgs": [
      "-c",
      "init",
      "-c",
      "reset halt",
      "-c",
      "esp stub_log on",
      "-d3",
      "-l log.txt"
  ]
}

@erhankur 按照您的操作步骤,已经生成了log文件,我将在链接中附带log.txt,请您查收,谢谢!

log.txt

@erhankur
Copy link

@XiaPeng1012 Could you please try adding no_clock_boost option to the programming command.

openocd -f board/esp32s3-builtin.cfg -d3 -l ocd.log -c 'init; program_esp_bins e:/Project/2025/Wireless_Tool/wireless_tool/build flasher_args.json no_clock_boost'

@brianignacio5 @radurentea Is it possible to add this option into the json file?

@XiaPeng1012
Copy link
Author

XiaPeng1012 commented Feb 26, 2025

@XiaPeng1012 Could you please try adding no_clock_boost option to the programming command.

openocd -f board/esp32s3-builtin.cfg -d3 -l ocd.log -c 'init; program_esp_bins e:/Project/2025/Wireless_Tool/wireless_tool/build flasher_args.json no_clock_boost'

@brianignacio5 @radurentea Is it possible to add this option into the json file?

@erhankur 很奇怪,现在即使没有这条命令也无法复现该问题,使用Jtag也能烧录成功。

@brianignacio5
Copy link
Collaborator

@XiaPeng1012 Could you please try adding no_clock_boost option to the programming command.

openocd -f board/esp32s3-builtin.cfg -d3 -l ocd.log -c 'init; program_esp_bins e:/Project/2025/Wireless_Tool/wireless_tool/build flasher_args.json no_clock_boost'

@brianignacio5 @radurentea Is it possible to add this option into the json file?

Sure we can, I'm just wondering, how can we determine when to add it ?

Right now extension sends a fixed TCL command program_esp_bins <buildPath> flasher_args.json verify reset to perform a JTAG flash. We could move last 2 arguments to an extension setting like "idf.jtagFlashCommandExtraArgs": ["verify", "reset"] and allow user to customize it. Does this solution makes sense @erhankur ?

@erhankur
Copy link

@brianignacio5 "idf.jtagFlashCommandExtraArgs" is a good idea. We can keep verify reset as the default, and the others can be added when needed. For example, the compress option might be useful to reduce programming time.

The full list is here;

https://docs.espressif.com/projects/esp-idf/en/latest/esp32c3/api-guides/jtag-debugging/index.html#upload-application-for-debugging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-report Bug Report from users on Github (don't use this tag manually, its supposed to be used via the issue)
Projects
None yet
4 participants