JTAG Upload ESP32 Solo failed

I want to use my jlink to upload

This is my terminal log:

CURRENT: upload_protocol = jlink
Uploading .pio\build\esp32dev\firmware.bin
Open On-Chip Debugger v0.10.0-esp32-20190708 (2019-07-08-11:04)
Licensed under GNU GPL v2
For bug reports, read
OpenOCD: Bug Reporting
debug_level: 1
adapter speed: 1000 kHz
esp32 interrupt mask on
** Programming Started **
auto erase enabled
Error: Failed to get flash maps (-1)!
Warn : Failed to get flash mappings (-4)!
Warn : Received debug request on stalled active core 0.
*** [upload] Error 5

The serial port upload works fine
I’m just learning VSCode

We need to see the full platformio.ini and a verbose upload log (pio run -t upload -v or Verbose Upload in the task list.)

This looks like a wiring problem, e.g.:

  • Application code using pins 12 to 15 required for the debugger
  • Debugger connections mixed up (on debugger or device side)
  • Debugger connected to an invalid pin that is used for accessing the flash memory

Please provide information about what board you are using and how you have connected it to the J-Link adapter.

Also you have selected the board “Espressif ESP32 Dev Board” which has a WROOM-32

probably not the SOLO variant you’re looking for which needs a different openocd target script. But let’s see the verbose upload first.

Here is my platformio.ini

[env:esp32dev]

platform = espressif32

board = esp32-solo

debug_tool = jlink

upload_protocol = jlink

framework = espidf

monitor_speed = 115200

build_flags = -DCOMPONENT_EMBED_TXTFILES=image.jpg

My terminal log

DEPRECATED! A legacy library storage `D:\OneDrive\Dokumente\BrP967_ESP32\VSCode\SPI_Test\.piolibdeps` has been found in a project. 
Please declare project dependencies in `platformio.ini` file using `lib_deps` option and remove `D:\OneDrive\Dokumente\BrP967_ESP32\VSCode\SPI_Test\.piolibdeps` folder.
More details -> http://docs.platformio.org/page/projectconf/section_env_library.html#lib-deps
Processing esp32dev (platform: espressif32; board: esp32-solo; debug_tool: jlink; upload_protocol: jlink; framework: espidf; monitor_speed: 115200; build_flags: -DCOMPONENT_EMBED_TXTFILES=image.jpg; lib_extra_dirs: D:\OneDrive\Dokumente\BrP967_ESP32\VSCode\SPI_Test\.piolibdeps)
------------------------------------------------------------------------------------------------------------------------------------------------------------
CONFIGURATION: 
PLATFORM: Espressif 32 1.9.0 > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (jlink) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES: toolchain-xtensa32 2.50200.80 (5.2.0), framework-espidf 3.30202.190627 (3.2.2), tool-esptoolpy 1.20600.0 (2.6.0), tool-openocd-esp32 1.1000.20190708 (10.0), tool-mkspiffs 2.230.0 (2.30)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
xtensa-esp32-elf-objcopy --input-target binary --output-target elf32-xtensa-le --binary-architecture xtensa --rename-section .data=.rodata.embedded image.jpg .pio\build\esp32dev\image.jpg.txt.o
xtensa-esp32-elf-gcc -o .pio\build\esp32dev\firmware.elf -T esp32_out.ld -nostdlib -Wl,-static -u call_user_start_cpu0 -Wl,--undefined=uxTopUsedPriority -Wl,--gc-sections -u __cxa_guard_dummy -u ld_include_panic_highint_hdl -T esp32.common.ld -T esp32.rom.ld -T esp32.peripherals.ld -T esp32.rom.libgcc.ld -T esp32.rom.spiram_incompatible_fns.ld -u __cxx_fatal_exception .pio\build\esp32dev\image.jpg.txt.o .pio\build\esp32dev\src\components\tjpgd\src\tjpgd.o .pio\build\esp32dev\src\decode_image.o .pio\build\esp32dev\src\pretty_effect.o .pio\build\esp32dev\src\spi_master_example_main.o -LC:\Users\Gerd\.platformio\packages\framework-espidf\components\esp32 -LC:\Users\Gerd\.platformio\packages\framework-espidf\components\esp32\ld -LC:\Users\Gerd\.platformio\packages\framework-espidf\components\esp32\ld\wifi_iram_opt -LC:\Users\Gerd\.platformio\packages\framework-espidf\components\esp32\lib -LC:\Users\Gerd\.platformio\packages\framework-espidf\components\bt\lib -LC:\Users\Gerd\.platformio\packages\framework-espidf\components\newlib\lib -L.pio\build\esp32dev -L.pio\build\esp32dev -Wl,--start-group .pio\build\esp32dev\libapp_update.a .pio\build\esp32dev\libasio.a .pio\build\esp32dev\libbt.a .pio\build\esp32dev\libcoap.a .pio\build\esp32dev\libconsole.a .pio\build\esp32dev\libcxx.a .pio\build\esp32dev\libdriver.a .pio\build\esp32dev\libesp-tls.a .pio\build\esp32dev\libesp_adc_cal.a .pio\build\esp32dev\libesp_event.a .pio\build\esp32dev\libesp_https_ota.a .pio\build\esp32dev\libesp_http_client.a .pio\build\esp32dev\libesp_http_server.a .pio\build\esp32dev\libesp_ringbuf.a .pio\build\esp32dev\libethernet.a .pio\build\esp32dev\libexpat.a .pio\build\esp32dev\libfatfs.a .pio\build\esp32dev\libfreemodbus.a .pio\build\esp32dev\libjsmn.a .pio\build\esp32dev\libjson.a .pio\build\esp32dev\liblog.a .pio\build\esp32dev\libmbedtls.a .pio\build\esp32dev\libmdns.a 
.pio\build\esp32dev\libmicro-ecc.a .pio\build\esp32dev\libmqtt.a .pio\build\esp32dev\libnewlib.a .pio\build\esp32dev\libnghttp.a .pio\build\esp32dev\libnvs_flash.a .pio\build\esp32dev\libopenssl.a .pio\build\esp32dev\libprotobuf-c.a .pio\build\esp32dev\libpthread.a .pio\build\esp32dev\libsdmmc.a .pio\build\esp32dev\libsmartconfig_ack.a .pio\build\esp32dev\libspiffs.a .pio\build\esp32dev\libtcpip_adapter.a .pio\build\esp32dev\libtcp_transport.a .pio\build\esp32dev\libulp.a .pio\build\esp32dev\libvfs.a .pio\build\esp32dev\libwear_levelling.a .pio\build\esp32dev\libwifi_provisioning.a .pio\build\esp32dev\libxtensa-debug-module.a .pio\build\esp32dev\libapp_trace.a .pio\build\esp32dev\libaws_iot.a .pio\build\esp32dev\libesp32.a .pio\build\esp32dev\libbootloader_support.a .pio\build\esp32dev\libheap.a .pio\build\esp32dev\libsoc.a .pio\build\esp32dev\libspi_flash.a .pio\build\esp32dev\liblwip.a .pio\build\esp32dev\libprotocomm.a 
.pio\build\esp32dev\libfreertos.a .pio\build\esp32dev\libsodium.a .pio\build\esp32dev\libwpa_supplicant.a -lbtdm_app -lhal -lcoexist -lcore -lnet80211 -lphy -lrtc -lpp -lwpa -lwpa2 -lespnow -lwps -lsmartconfig -lmesh -lc -lm -lgcc -lstdc++ -Wl,--end-group
"C:\Users\Gerd\.platformio\penv\Scripts\python.exe" "C:\Users\Gerd\.platformio\packages\tool-esptoolpy\esptool.py" --chip esp32 elf2image --flash_mode dio --flash_freq 40m --flash_size 4MB -o .pio\build\esp32dev\firmware.bin .pio\build\esp32dev\firmware.elf
<lambda>(["checkprogsize"], [".pio\build\esp32dev\firmware.elf"])
MethodWrapper(["checkprogsize"], [".pio\build\esp32dev\firmware.elf"])
Memory Usage -> 
DATA:    [          ]   4.1% (used 13380 bytes from 327680 bytes)
PROGRAM: [==        ]  19.2% (used 201449 bytes from 1048576 bytes)
.pio\build\esp32dev\firmware.elf  :

section             size         addr

.rtc.text              0   1074528256

.rtc.dummy             0   1073217536

.rtc.force_fast        0   1073217536

.rtc_noinit            0   1342177280

.rtc.force_slow        0   1342177280

.iram0.vectors      1024   1074266112

.iram0.text        47309   1074267136
Open On-Chip Debugger  v0.10.0-esp32-20190708 (2019-07-08-11:04)

.dram0.data         7068   1073470304
Licensed under GNU GPL v2

.noinit                0   1073477372

       
.dram0.bss          6312   1073477376

debug_level: 2
.flash.rodata      49108   1061158944

adapter speed: 1000 kHz
.flash.text        96940   1074593816
Info : Configured 1 cores

esp32 interrupt mask on
.comment             303            0

Info : J-Link V11 compiled Aug 14 2019 16:21:09
.xtensa.info          56            0

Info : Hardware version: 11.00
.debug_line       111431            0
Info : VTarget = 3.166 V

Info : clock speed 1000 kHz
.debug_info       158087            0

Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
.debug_abbrev      33038            0
Info : Target halted. PRO_CPU: PC=0x40000
40.debug_aranges      3696            0
0

Info : Listening on port 3333.debug_str         25692            0
 f
or.debug_frame        7848            0
 g
db.debug_loc        102226            0
 c
on.debug_ranges       3192            0
ne
ctTotal             653330
ionesptool.py v2.6
s
<lambda>(["upload"], [".pio\build\esp32dev\firmware.bin"])
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
AVAILABLE: esp-prog, espota, esptool, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa
CURRENT: upload_protocol = jlink
Info : esp32: Debug controller 0 was reset (pwrstat=0x5F, after clear 0x0F).
openocd -d2 -s C:/Users/Gerd/.platformio/packages/tool-openocd-esp32/share/openocd/scripts -f interface/jlink.cfg -f board/esp32-solo-1.cfg -c "program_esp32 {{.pio\build\esp32dev\firmware.bin}} 0x10000Info : esp32: Core 0 was reset (pwrstat=0x5F, after clear 0x0F).
 veInfo : Target halted. PRO_CPU: PC=0x5000r0i0f4yB"
 -cInfo : esp32: Core 0 was reset (pwrstat=0x1F, after clear 0x0F).
 "Info : Target halted. PRO_CPU: PC=0x4000p0r4o0g0r
am** Programming Started **
_esauto erase enabled
p32 {{D:\OneDrive\Dokumente\BrP967_ESP32\VSCode\SPI_Test\.pio\build\esp32dev/bootloader.bin}} 0x1000 verify" -c "program_esp32 {{D:\OneDrive\Dokumente\BrP967_ESP32\VSCode\SPI_Test\.pio\build\esp32dev/partitions.bin}} 0x8000 verify" -c "reset run; shutdown"
Info : Target halted. PRO_CPU: PC=0x400916EE
Info : Flash mapping 0: 0x10020 -> 0x3f400020, 47 KB
Info : Target halted. PRO_CPU: PC=0x400916EE
Info : Auto-detected flash size 4096 KB
Info : Using flash size 4096 KB
Info : xtensa_poll: Target offline
Error: xtensa_poll: Target failure
Info : Target halted. PRO_CPU: PC=0x40090D79
Error: xtensa_wait_algorithm: not halted 0, pc 0x40090d79, ps 0x60025
Error: Failed to wait algorithm (-302)!
Error: Algorithm run failed (-302)!
Error: Failed to run flasher stub (-302)!
Error: failed erasing sectors 16 to 65
embedded:startup.tcl:480: Error: ** Programming Failed **
in procedure 'program_esp32' 
in procedure 'program_error' called at file "C:/Users/Gerd/.platformio/packages/tool-openocd-esp32/share/openocd/scripts/target/esp32-solo-1.cfg", line 150 
at file "embedded:startup.tcl", line 480
Warn : Flash driver of esp32.flash does not support free_driver_priv()
Warn : Flash driver of irom does not support free_driver_priv()
Warn : Flash driver of drom does not support free_driver_priv()
*** [upload] Error 1
=============================================================== [FAILED] Took 52.19 seconds =============================================================== 
PS D:\OneDrive\Dokumente\BrP967_ESP32\VSCode\SPI_Test>

Where did you get this board definition from? It’s not in platform-espressif32/boards at develop · platformio/platform-espressif32 · GitHub… It does however invoke the correct board cfg file esp32-solo-1.cfg

So first of all this error is now different from the one you had before? Also, according to JLink + openocd for ESP32WROOM not working - ESP32 Forum this error can be triggered when you have a poor cable connection from the debugger to the board which can’t handle the high-frequency signals. You should try to into the file C:/Users/Gerd/.platformio/packages/tool-openocd-esp32/share/openocd/scripts/target/esp32-solo-1.cfg and change the line

adapter_khz 20000

to something like

adapter_khz 1000

or even lower if errors occur.

Hello Max
Thank you for your help

I allready changed the clk to 1000
I did not find a ESP32-SOLO Board config, so I made a copy.
Actually I’m not sure in what files are to be edit/customized

So you created a boards/ folder in your project with a esp32-solo.json file? What is the content?

This was a misunderstanding
I modified board/esp32-solo-1.cfg

Here is the content

# Example OpenOCD configuration file for ESP32-SOLO-1 module.
# By default, the following configuration is used:
# - support for listing FreeRTOS tasks is enabled
# - OpenOCD is configured to set SPI flash voltage at 3.3V
#   by keeping MTDI bootstrapping pin low
#
# Use variables listed below to customize this.
# Variables can be modified in this file or set on the command line.
#
# For example, OpenOCD can be started for debugging w/o OS supporrt on
# ESP-WROVER-KIT with ESP32-SOLO-1 module as follows:
#
#   openocd -f interface/ftdi/esp32_devkitj_v1.cfg -c 'set ESP32_RTOS none' -f board/esp32-solo-1.cfg
#
# If a different JTAG interface is used, change the first -f option.
#
# If OpenOCD is built from source, pass an additional -s option to specify
# the location of 'tcl' directory:
#
#    src/openocd -s tcl <rest of the command line>
#
# Note:
#   For ESP32-WROVER module use 'esp32-wrover.cfg' configuration file
#   ESP-WROOM-32/ESP32-SOLO-1 and ESP32-WROVER have different flash voltage setting


# The ESP32 only supports JTAG.
transport select jtag

# The speed of the JTAG interface, in KHz. If you get DSR/DIR errors (and they
# do not relate to OpenOCD trying to read from a memory range without physical
# memory being present there), you can try lowering this.
#
# On DevKit-J, this can go as high as 20MHz if CPU frequency is 80MHz, or 26MHz
# if CPU frequency is 160MHz or 240MHz.
adapter_khz 500

# Single core version of ESP32
set ESP32_ONLYCPU 1

# To disable RTOS support, uncomment the following line
# set ESP32_RTOS none

# Tell OpenOCD which SPI flash voltage is used by the board (3.3 or 1.8)
# The TDI pin of ESP32 is also a bootstrap pin that selects the voltage the SPI flash
# chip runs at. When a hard reset happens (e.g. because someone switches the board off
# and on) the ESP32 will use the current TDI value as the bootstrap value because the
# JTAG adapter overrides the pull-up or pull-down resistor that is supposed to do the
# bootstrapping. These lines basically set the idle value of the TDI line to a
# specified value, therefore reducing the chance of a bad bootup due to a bad flash
# voltage greatly.
# This option defaults to 3.3, if not set. To override the default, uncomment
# the following line:
 set ESP32_FLASH_VOLTAGE 1.8

# Source the ESP32 configuration file
source [find target/esp32-solo-1.cfg]

I reduced the clk to 500kHz

This is my terminal
Open On-Chip Debugger v0.10.0-esp32-20190708 (2019-07-08-11:04)
Licensed under GNU GPL v2
For bug reports, read
OpenOCD: Bug Reporting
debug_level: 1
adapter speed: 500 kHz
esp32 interrupt mask on
** Programming Started **
auto erase enabled
Error: Failed to get flash maps (-1)!
Warn : Failed to get flash mappings (-4)!
Warn : Received debug request on stalled active core 0.
*** [upload] Error 5

My solo json

{
  "build": {
    "core": "esp32",
    "extra_flags": "-DARDUINO_ESP32_DEV",
    "f_cpu": "240000000L",
    "f_flash": "40000000L",
    "flash_mode": "dio",
    "ldscript": "esp32_out.ld",
    "mcu": "esp32",
    "variant": "esp32"
  },
  "connectivity": [
    "wifi",
    "bluetooth",
    "ethernet",
    "can"
  ],
  "debug": {
    "openocd_board": "esp32-solo-1.cfg"
  },
  "frameworks": [
    "arduino",
    "espidf"
  ],
  "name": "Espressif ESP32 Dev Module",
  "upload": {
    "flash_size": "4MB",
    "maximum_ram_size": 327680,
    "maximum_size": 4194304,
    "require_upload_port": true,
    "speed": 921600
  },
  "url": "https://en.wikipedia.org/wiki/ESP32",
  "vendor": "Espressif"
}

… I’m having a hard time finding a working reference. To my knowledge this chip /module isn’t even supported by Arduino-ESP32 yet, according to the boards.txt. Did you previously get it working with arduino?

Thank you very much for your support.
I didn’t try it
I will continue tomorrow