Uploading with ftdi fails only for arduino framework

An identical esp32 arduino framework program runs if uploaded via serial, but when uploaded via ftdi, it just does software reset 0x3 repeatedly. When uploaded with ftdi, the verifications are OK, the so the IO must be OK, and the flash is being written correctly. Even disconnecting the jtag and restarting, the program just resets.

rst:0x3 (SW_RESET),boot:0x33 (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:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:8896
load:0x40080400,len:5828
entry 0x400806ac
ets Jun  8 2016 00:22:57

An esf-idf program on the same board with the same debugger works fine serially or with debugger.
An esp-idf,arduino program also works fine with ftdi upload.
ONLY the ARDUINO framework alone fails.

This is a custom memory configuration for a wrover 16 MB. But I’m not sure of that is relevant.
It seems maybe these files are wrong when using the arduino framework because they are coming straight from .platformio/packages/framework-arduinoespressif32/tools/partitions:

  • bootloader_dio_40m.bin
  • partitions.bin
  • boot_app0.bin

But if I use the esp-idf they come form my project:
.pio\build

Shouldn’t they be custom built also?

Here is my platfromio.ini

[env:esp32_wrover_16M_FT2232H]
platform = espressif32
framework = arduino
board = esp32_wrover_16M_FT2232H
monitor_speed = 115200
upload_speed = 460800
upload_port = COM6
board_build.partitions = default_16MB.csv
;debug_tool = ftdi
upload_protocol = ftdi
debug_init_break = tbreak setup

Here is my custom board config:

{
“build”: {
“core”: “esp32”,
“extra_flags”: “-DARDUINO_ESP32_DEV”,
“f_cpu”: “240000000L”,
“f_flash”: “40000000L”,
“flash_mode”: “dio”,
“hwids”: [
[
“0x0403”,
“0x6014”
]
],
“ldscript”: “esp32_out.ld”,
“mcu”: “esp32”,
“variant”: “esp32”
},
“connectivity”: [
“wifi”,
“bluetooth”,
“ethernet”,
“can”
],
“debug”: {
“default_tool”: “ftdi”,
“onboard_tools”: [
“ftdi”
],
“openocd_board”: “esp32-wrover.cfg”
},
“frameworks”: [
“arduino”,
“espidf”
],
“name”: “Espressif ESP-WROVER-CUSTOM_16MB”,
“upload”: {
“flash_size”: “16MB”,
“maximum_ram_size”: 327680,
“maximum_size”: 16777216,
“protocols”: [
“esptool”,
“espota”,
“ftdi”
],
“require_upload_port”: true,
“speed”: 460800
},
“url”: “Overview | Espressif Systems”,
“vendor”: “Espressif”
}

No feedback on this?

Elevated to: https://github.com/platformio/platform-espressif32/issues/241

Note: It is possible to workaround this issue by using:
debug_load_cmds = preload
which confirms the issue is with the build, not the debugger itself.