VS Code Blink Debug Problems

vpascucci
Posts: 3
Joined: Fri Apr 09, 2021 6:12 am

VS Code Blink Debug Problems

Postby vpascucci » Fri Apr 09, 2021 6:43 am

Hello everyone,

I am using VS Code and trying to follow this guide:
https://github.com/espressif/vscode-esp ... bugging.md
in order to debug the blink example.

I am using an ESP32-WROOM board, and as a JTAG debugger I am using a digilent-hs2. Building, flashing and monitoring works fine, however debugging ("Launch" configuration) Seems to have some kind of issue.

I created the project by running ESP-IDF: Show example projects and selecting the "blink" project. I then set the correct target and openOCD config files by running ESP-IDF: Device configuration. The launch configuration looks like this:

launch.json:

{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "espidf",
"name": "Launch",
"request": "launch"
}
]
}


however the following happens when I start the "Launch" configuration:

- the debug window shows the following:

Debug adapter -> Extension: DEBUG_ADAPTER_STARTED
Debug adapter -> Extension: DEBUG_ADAPTER_READY2CONNECT
Debug Adapter initialized
Debug Adapter is running


- the terminal starts the "monitor" task (I didn't expect that) and shows the following:

Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.

PS C:\Users\vpascucci\Desktop\esp32_blink_vscode\blink2> C:\esp\.espressif\python_env\idf4.2_py3.8_env\Scripts\python.exe C:\esp\esp-idf\tools\idf.py -p COM13 monitor
Executing action: monitor
Running idf_monitor in directory c:\users\vpascucci\desktop\esp32_blink_vscode\blink2
Executing "C:\esp\.espressif\python_env\idf4.2_py3.8_env\Scripts\python.exe C:\esp\esp-idf\tools/idf_monitor.py -p COM13 -b 115200 --toolchain-prefix xtensa-esp32-elf- c:\users\vpascucci\desktop\esp32_blink_vscode\blink2\build\blink.elf -m 'C:\esp\.espressif\python_env\idf4.2_py3.8_env\Scripts\python.exe' 'C:\esp\esp-idf\tools\idf.py' '-p' 'COM13'"...
←[0;33m--- WARNING: GDB cannot open serial ports accessed as COMx←[0m
←[0;33m--- Using \\.\COM13 instead...←[0m
--- idf_monitor on \\.\COM13 115200 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
ets Jun 8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:4
load:0x3fff0034,len:7012
load:0x40078000,len:13212
load:0x40080400,len:4568
0x40080400: _init at ??:?

entry 0x400806f4
I (29) boot: ESP-IDF v4.2 2nd stage bootloader
I (29) boot: compile time 08:22:58
I (29) boot: chip revision: 1
I (31) boot_comm: chip revision: 1, min. bootloader chip revision: 0
I (39) boot.esp32: SPI Speed : 40MHz
I (43) boot.esp32: SPI Mode : DIO
I (48) boot.esp32: SPI Flash Size : 2MB
I (52) boot: Enabling RNG early entropy source...
I (58) boot: Partition Table:
I (61) boot: ## Label Usage Type ST Offset Length
I (69) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (76) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (83) boot: 2 factory factory app 00 00 00010000 00100000
I (91) boot: End of partition table
I (95) boot_comm: chip revision: 1, min. application chip revision: 0
I (102) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x05ae0 ( 23264) map
I (120) esp_image: segment 1: paddr=0x00015b08 vaddr=0x3ffb0000 size=0x0206c ( 8300) load
I (124) esp_image: segment 2: paddr=0x00017b7c vaddr=0x40080000 size=0x00404 ( 1028) load
0x40080000: _WindowOverflow4 at C:/esp/esp-idf/components/freertos/xtensa/xtensa_vectors.S:1730

I (130) esp_image: segment 3: paddr=0x00017f88 vaddr=0x40080404 size=0x08090 ( 32912) load
I (152) esp_image: segment 4: paddr=0x00020020 vaddr=0x400d0020 size=0x12e40 ( 77376) map
0x400d0020: _stext at ??:?

I (182) esp_image: segment 5: paddr=0x00032e68 vaddr=0x40088494 size=0x01a1c ( 6684) load
0x40088494: rtc_init at C:/esp/esp-idf/components/soc/src/esp32/rtc_init.c:51

I (191) boot: Loaded app from partition at offset 0x10000
I (191) boot: Disabling RNG early entropy source...
I (192) cpu_start: Pro cpu up.
I (195) cpu_start: Application information:
I (200) cpu_start: Project name: blink
I (205) cpu_start: App version: 1
I (209) cpu_start: Compile time: Apr 9 2021 08:21:39
I (215) cpu_start: ELF file SHA256: 2a0873531652dd5b...
I (221) cpu_start: ESP-IDF: v4.2
I (226) cpu_start: Starting app cpu, entry point is 0x400815c0
0x400815c0: call_start_cpu1 at C:/esp/esp-idf/components/esp32/cpu_start.c:287

I (0) cpu_start: App cpu up.
I (237) heap_init: Initializing. RAM available for dynamic allocation:
I (243) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (249) heap_init: At 3FFB28A0 len 0002D760 (181 KiB): DRAM
I (256) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (262) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (268) heap_init: At 40089EB0 len 00016150 (88 KiB): IRAM
I (275) cpu_start: Pro cpu start user code
I (293) spi_flash: detected chip: generic
I (294) spi_flash: flash io: dio
W (294) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (304) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
Turning off the LED
Turning on the LED
Turning off the LED
Turning on the LED
Turning off the LED
Turning on the LED
.
.
.


This seems to suggest that the program, which should be halted at the first instruction in app_main() is in fact running

- The output shows the following:

DEBUG_ADAPTER_STARTED
2021-04-09 08:26:33,794 - Debug Adapter (main) - CRITICAL - Debug adapter -> Extension: DEBUG_ADAPTER_STARTED
DEBUG_ADAPTER_READY2CONNECT
2021-04-09 08:26:33,802 - Debug Adapter (main) - CRITICAL - Debug adapter -> Extension: DEBUG_ADAPTER_READY2CONNECT



If I then press the "continue" arrow in the debug window nothing happens, and I cannot halt the process any more (which probably wasn't halted in the first place, as we discussed.

I should note that I also set up the same project to work with the "Native Debug" extension, and there, with same buard, debugger and general settings I can debug and step the code just fine. Any idea of what I might be doing wrong?

Thank you

ESP_bignacio
Posts: 213
Joined: Wed May 02, 2018 12:12 pm

Re: VS Code Blink Debug Problems

Postby ESP_bignacio » Fri Apr 16, 2021 2:39 pm

Maybe you can try disabling launching the monitor by setting `idf.launchMonitorOnDebugSession` to false and try again.

Who is online

Users browsing this forum: lmx121 and 32 guests