Using custom partitions.csv kills JTAG

felixcollins
Posts: 125
Joined: Fri May 24, 2019 2:02 am

Using custom partitions.csv kills JTAG

Postby felixcollins » Tue Aug 31, 2021 5:15 am

I'm running VisualGDB and doing flashing and debugging over JTAG with Tumpa Lite board. The project is using ESP32 Arduino. The target is a Wroom 4MB on a custom board. Everything works well but I needed a factory + 2x OTA partition setup. I tried the solution of generating a custom partitions.csv in the sketches folder. When I program the board I get the following log from GDB and the programming fails. I can only recover by using ESPtool to erase the whole flash. What can I do to allow my custom partitions to work? Thanks, Felix

Partiions.csv
# Name , Type, SubType, Offset, Size , Flags
nvs , data, nvs , 0x9000, 0x5000 ,
otadata, data, ota , 0xe000, 0x2000 ,
factory, app , factory, 0x10000, 0x100000,
app0 , app , ota_0 , 0x110000,0x100000,
app1 , app , ota_1 , 0x210000,0x100000,
spiffs , data, spiffs , 0x310000, 0x30000,


GDB LOG Follows

Code: Select all

C:\Users\felix\AppData\Local\Arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\1.22.0-97-gc752ad5-5.2.0\bin\\xtensa-esp32-elf-gdb --interpreter mi "C:/Users/felix/source/Thor/fw-10320-sensor-hub-esp32-firmware/FW-10320-sensor-hub-esp32-FW/Output/ESP32_Dev_Module/Debug/FW-10320-Sensor-Hub-ESP32-FW.ino.elf"
-gdb-version
=thread-group-added,id="i1"
~"GNU gdb (crosstool-NG crosstool-ng-1.22.0-97-gc752ad5d) 7.10\n"
~"Copyright (C) 2015 Free Software Foundation, Inc.\n"
~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.  Type \"show copying\"\nand \"show warranty\" for details.\n"
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
~"This GDB was configured as \"--host=i686-host_w64-mingw32 --target=xtensa-esp32-elf\".\nType \"show configuration\" for configuration details."
This GDB was configured as "--host=i686-host_w64-mingw32 --target=xtensa-esp32-elf".
Type "show configuration" for configuration details.
~"\nFor bug reporting instructions, please see:\n"
~"<http://www.gnu.org/software/gdb/bugs/>.\n"
~"Find the GDB manual and other documentation resources online at:\n<http://www.gnu.org/software/gdb/documentation/>.\n"
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
~"For help, type \"help\".\n"
~"Type \"apropos word\" to search for commands related to \"word\"...\n"
~"Reading symbols from C:/Users/felix/source/Thor/fw-10320-sensor-hub-esp32-firmware/FW-10320-sensor-hub-esp32-FW/Output/ESP32_Dev_Module/Debug/FW-10320-Sensor-Hub-ESP32-FW.ino.elf..."
~"done.\n"
~"GNU gdb (crosstool-NG crosstool-ng-1.22.0-97-gc752ad5d) 7.10\n"
~"Copyright (C) 2015 Free Software Foundation, Inc.\n"
~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.  Type \"show copying\"\nand \"show warranty\" for details.\n"
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
~"This GDB was configured as \"--host=i686-host_w64-mingw32 --target=xtensa-esp32-elf\".\nType \"show configuration\" for configuration details."
This GDB was configured as "--host=i686-host_w64-mingw32 --target=xtensa-esp32-elf".
Type "show configuration" for configuration details.
~"\nFor bug reporting instructions, please see:\n"
~"<http://www.gnu.org/software/gdb/bugs/>.\n"
~"Find the GDB manual and other documentation resources online at:\n<http://www.gnu.org/software/gdb/documentation/>.\n"
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
~"For help, type \"help\".\n"
~"Type \"apropos word\" to search for commands related to \"word\".\n"
^done
-list-features
^done,features=["frozen-varobjs","pending-breakpoints","thread-info","data-read-memory-bytes","breakpoint-notifications","ada-task-info","language-option","info-gdb-mi-command","undefined-command-error-code","exec-run-start-option"]
-gdb-set verbose on
^done
-gdb-set disassembly-flavor intel
^error,msg="No symbol \"disassembly\" in current context."
-gdb-set print demangle off
^done
set remotetimeout 60
&"set remotetimeout 60\n"
=cmd-param-changed,param="remotetimeout",value="60"
^done
target remote :59367
&"target remote :59367\n"
~"Remote debugging using :59367\n"
=thread-group-started,id="i1",pid="42000"
=thread-created,id="1",group-id="i1"
~"Reading in symbols for /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/pm_esp32.c..."
~"done.\n"
~"0x401834c2 in esp_pm_impl_waiti () at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/pm_esp32.c:492\n"
&"492\t/home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/pm_esp32.c: No such file or directory.\n"
*stopped,frame={addr="0x401834c2",func="esp_pm_impl_waiti",args=[],file="/home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/pm_esp32.c",fullname="/home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/pm_esp32.c",line="492"},thread-id="1",stopped-threads="all"
^done
info shared
&"info shared\n"
~"No shared libraries loaded at this time.\n"
^done
mon gdb_breakpoint_override hard
&"mon gdb_breakpoint_override hard\n"
@"force hard breakpoints\n"
^done
mon reset halt
&"mon reset halt\n"
@"JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)\n"
@"JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)\n"
@"esp32.cpu0: Debug controller was reset.\n"
@"esp32.cpu0: Core was reset.\n"
@"esp32.cpu0: Target halted, PC=0x500000CF, debug_reason=00000000\n"
@"esp32.cpu0: Core was reset.\n"
@"esp32.cpu0: Target halted, PC=0x40000400, debug_reason=00000000\n"
@"esp32.cpu1: Debug controller was reset.\n"
@"esp32.cpu1: Core was reset.\n"
@"esp32.cpu1: Target halted, PC=0x40000400, debug_reason=00000000\n"
^done
mon program_esp "C:/Users/felix/AppData/Local/Arduino15/packages/esp32/hardware/esp32/1.0.6/tools/partitions/boot_app0.bin" 0xe000
&"mon program_esp \"C:/Users/felix/AppData/Local/Arduino15/packages/esp32/hardware/esp32/1.0.6/tools/partitions/boot_app0.bin\" 0xe000\n"
@"JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)\n"
@"JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)\n"
@"esp32.cpu0: Debug controller was reset.\n"
@"esp32.cpu0: Core was reset.\n"
@"esp32.cpu0: Target halted, PC=0x500000CF, debug_reason=00000000\n"
@"esp32.cpu0: Core was reset.\n"
@"esp32.cpu0: Target halted, PC=0x40000400, debug_reason=00000000\n"
@"esp32.cpu1: Debug controller was reset.\n"
@"esp32.cpu1: Core was reset.\n"
@"esp32.cpu1: Target halted, PC=0x40000400, debug_reason=00000000\n"
@"esp32.cpu0: Target halted, PC=0x400928DA, debug_reason=00000001\n"
@"Flash mapping 0: 0x10020 -> 0x3f400020, 171 KB\n"
@"Flash mapping 1: 0x40018 -> 0x400d0018, 718 KB\n"
@"esp32.cpu0: Target halted, PC=0x400928DA, debug_reason=00000001\n"
@"Auto-detected flash bank 'esp32.cpu1.flash' size 4096 KB\n"
@"Using flash bank 'esp32.cpu1.flash' size 4096 KB\n"
@"** Programming Started **\n"
@"timed out while waiting for target halted / 4 - 2\n"
@"esp32.cpu0: Target halted, PC=0x40008547, debug_reason=00000000\n"
@"xtensa_wait_algorithm: not halted 0, pc 0x40008547, ps 0x60025\n"
@"Failed to wait algorithm (-302)!\n"
@"Algorithm run failed (-302)!\n"
@"not enough working area available(requested 10433)\n"
@"no working area available, can't alloc space for stub code!\n"
@"not enough working area available(requested 10433)\n"
@"no working area available, can't alloc space for stub code!\n"
@"** Programming Finished **\n"
^done
mon program_esp "C:/Users/felix/AppData/Local/Arduino15/packages/esp32/hardware/esp32/1.0.6/tools/sdk/bin/bootloader_qio_80m.bin" 0x1000
&"mon program_esp \"C:/Users/felix/AppData/Local/Arduino15/packages/esp32/hardware/esp32/1.0.6/tools/sdk/bin/bootloader_qio_80m.bin\" 0x1000\n"
@"JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)\n"
@"JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)\n"
@"esp32.cpu0: Debug controller was reset.\n"
@"esp32.cpu0: Core was reset.\n"
@"esp32.cpu0: Target halted, PC=0x500000CF, debug_reason=00000000\n"
@"esp32.cpu0: Core was reset.\n"
@"esp32.cpu0: Target halted, PC=0x40000400, debug_reason=00000000\n"
@"esp32.cpu1: Debug controller was reset.\n"
@"esp32.cpu1: Core was reset.\n"
@"esp32.cpu1: Target halted, PC=0x40000400, debug_reason=00000000\n"
@"** Programming Started **\n"
@"timed out while waiting for target halted / 4 - 2\n"
@"esp32.cpu0: Target halted, PC=0x4000C050, debug_reason=00000000\n"
@"xtensa_wait_algorithm: not halted 0, pc 0x4000c050, ps 0x60025\n"
@"Failed to wait algorithm (-302)!\n"
@"Algorithm run failed (-302)!\n"
@"not enough working area available(requested 10433)\n"
@"no working area available, can't alloc space for stub code!\n"
@"not enough working area available(requested 10433)\n"
@"no working area available, can't alloc space for stub code!\n"
@"** Programming Finished **\n"
^done
mon program_esp "C:/Users/felix/source/Thor/fw-10320-sensor-hub-esp32-firmware/FW-10320-sensor-hub-esp32-FW/Output/ESP32_Dev_Module/Debug/FW-10320-Sensor-Hub-ESP32-FW.ino.bin" 0x10000
&"mon program_esp \"C:/Users/felix/source/Thor/fw-10320-sensor-hub-esp32-firmware/FW-10320-sensor-hub-esp32-FW/Output/ESP32_Dev_Module/Debug/FW-10320-Sensor-Hub-ESP32-FW.ino.bin\" 0x10000\n"
@"JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)\n"
@"JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)\n"
@"esp32.cpu0: Debug controller was reset.\n"
@"esp32.cpu0: Core was reset.\n"
@"esp32.cpu0: Target halted, PC=0x500000CF, debug_reason=00000000\n"
@"esp32.cpu0: Core was reset.\n"
@"esp32.cpu0: Target halted, PC=0x40000400, debug_reason=00000000\n"
@"esp32.cpu1: Debug controller was reset.\n"
@"esp32.cpu1: Core was reset.\n"
@"esp32.cpu1: Target halted, PC=0x40000400, debug_reason=00000000\n"
@"** Programming Started **\n"
@"timed out while waiting for target halted / 4 - 2\n"
@"esp32.cpu0: Target halted, PC=0x40090363, debug_reason=00000000\n"
@"xtensa_wait_algorithm: not halted 0, pc 0x40090363, ps 0x60025\n"
@"Failed to wait algorithm (-302)!\n"
@"Algorithm run failed (-302)!\n"
@"not enough working area available(requested 10433)\n"
@"no working area available, can't alloc space for stub code!\n"
@"not enough working area available(requested 10433)\n"
@"no working area available, can't alloc space for stub code!\n"
@"** Programming Finished **\n"
^done
mon program_esp "C:/Users/felix/source/Thor/fw-10320-sensor-hub-esp32-firmware/FW-10320-sensor-hub-esp32-FW/Output/ESP32_Dev_Module/Debug/FW-10320-Sensor-Hub-ESP32-FW.ino.partitions.bin" 0x8000
&"mon program_esp \"C:/Users/felix/source/Thor/fw-10320-sensor-hub-esp32-firmware/FW-10320-sensor-hub-esp32-FW/Output/ESP32_Dev_Module/Debug/FW-10320-Sensor-Hub-ESP32-FW.ino.partitions.bin\" 0x8000\n"
@"JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)\n"
@"JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)\n"
@"esp32.cpu0: Debug controller was reset.\n"
@"esp32.cpu0: Core was reset.\n"
@"esp32.cpu0: Target halted, PC=0x500000CF, debug_reason=00000000\n"
@"esp32.cpu0: Core was reset.\n"
@"esp32.cpu0: Target halted, PC=0x40000400, debug_reason=00000000\n"
@"esp32.cpu1: Debug controller was reset.\n"
@"esp32.cpu1: Core was reset.\n"
@"esp32.cpu1: Target halted, PC=0x40000400, debug_reason=00000000\n"
@"** Programming Started **\n"
@"timed out while waiting for target halted / 4 - 2\n"
@"esp32.cpu0: Target halted, PC=0x4000C050, debug_reason=00000000\n"
@"xtensa_wait_algorithm: not halted 0, pc 0x4000c050, ps 0x60025\n"
@"Failed to wait algorithm (-302)!\n"
@"Algorithm run failed (-302)!\n"
@"not enough working area available(requested 10433)\n"
@"no working area available, can't alloc space for stub code!\n"
@"not enough working area available(requested 10433)\n"
@"no working area available, can't alloc space for stub code!\n"
@"** Programming Finished **\n"
^done
mon reset halt
&"mon reset halt\n"
@"JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)\n"
@"JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)\n"
@"esp32.cpu0: Debug controller was reset.\n"
@"esp32.cpu0: Core was reset.\n"
@"esp32.cpu0: Target halted, PC=0x500000CF, debug_reason=00000000\n"
=thread-group-exited,id="i1"
&"Remote communication error.  Target disconnected.: No such file or directory.\n"
^error,msg="Remote communication error.  Target disconnected.: No such file or directory."
-target-disconnect
^error,msg="You can't do that when your target is `exec'"
-gdb-exit
^exit

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: Using custom partitions.csv kills JTAG

Postby ESP_igrr » Tue Aug 31, 2021 9:02 am

It looks like GDB is flashing the app to 0x10000 while in your custom partitions file the offset is different. Perhaps that's the reason?
Which environment are you using to work with GDB? Command line, Eclipse, VS Code, something else? It's probably a matter of adjusting the flashing commands in that environment.

chegewara
Posts: 2364
Joined: Wed Jun 14, 2017 9:00 pm

Re: Using custom partitions.csv kills JTAG

Postby chegewara » Tue Aug 31, 2021 11:01 am

Code: Select all

@"Algorithm run failed (-302)!\n"
@"not enough working area available(requested 10433)\n"
@"no working area available, can't alloc space for stub code!\n"
@"not enough working area available(requested 10433)\n"
@"no working area available, can't alloc space for stub code!\n"
@"** Programming Finished **\n"
Im guessing your app exceeds 1MB in size, which is the size of your partition.

felixcollins
Posts: 125
Joined: Fri May 24, 2019 2:02 am

Re: Using custom partitions.csv kills JTAG

Postby felixcollins » Wed Sep 01, 2021 1:54 am

1. I'm using Visual GDB from sysprogs. I'm running with an Arduino ESP32 project.
2. From debug logging it seems that the partition table is not being rewritten by the GDB commands from VGDB. This seems to be a VGDB bug.
3. The second stage bootloader from Arduino does not seem to support a factory partition. It seems to be precompiled and shipped as a bin to support two app partitions named app0 and app1.

I guess I need to get rid of Arduino and use pure IDF if I want factory and two ota.

Who is online

Users browsing this forum: Google [Bot] and 79 guests