Failed to get flash mappings (-4)

ClausHM
Posts: 1
Joined: Wed Mar 02, 2022 6:51 pm

Failed to get flash mappings (-4)

Postby ClausHM » Wed Mar 02, 2022 7:06 pm

Hi all

I try to program a ESP32 WROVER board from ESP32-PROG.

It looks like it works, but the process does not look good. For the bootloader it will program and verify, but for the partition table, OTA and app it stops after program finished.

I use this line from a batch file:

openocd -f interface/ftdi/esp32_devkitj_v1.cfg -f board/esp32-wrover-kit-3.3v.cfg -c "program_esp partition-table.bin 0xE000
verify reset exit"

This gives me the following:

C:\Temp\build_esp32 - Copy2>prog_partition_table

openocd -f interface/ftdi/esp32_devkitj_v1.cfg -f b
oard/esp32-wrover-kit-3.3v.cfg -c "program_esp partition_table/partition-table.b
in 0xE000
Open On-Chip Debugger v0.11.0-esp32-20211220 (2021-12-20-15:43)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
adapter speed: 500 kHz

Warn : Interface already configured, ignoring
Info : clock speed 500 kHz
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica)
, part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica)
, part: 0x2003, ver: 0x1)
Info : esp32.cpu0: Target halted, PC=0x40000400, debug_reason=00000001
Info : esp32.cpu1: Target halted, PC=0x40000400, debug_reason=00000000
Info : starting gdb server for esp32.cpu0 on 3333
Info : Listening on port 3333 for gdb connections
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica)
, part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica)
, part: 0x2003, ver: 0x1)
Info : esp32.cpu0: Debug controller was reset.
Info : esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
Info : Set GDB target to 'esp32.cpu0'
Info : esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x40000400, debug_reason=00000000
Info : esp32.cpu1: Debug controller was reset.
Info : esp32.cpu1: Core was reset.
Info : esp32.cpu1: Target halted, PC=0x40000400, debug_reason=00000000
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
Error: Failed to get flash maps (4294967290)!
Warn : Failed to get flash mappings (-4)!
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
Info : Auto-detected flash bank 'esp32.cpu0.flash' size 8192 KB
Info : Using flash bank 'esp32.cpu0.flash' size 8192 KB
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
Error: Failed to get flash maps (4294967290)!
Warn : Failed to get flash mappings (-4)!
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
Info : Auto-detected flash bank 'esp32.cpu1.flash' size 8192 KB
Info : Using flash bank 'esp32.cpu1.flash' size 8192 KB
** Programming Started **
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
Info : PROF: Data transferred in 165.009 ms @ 24.2411 KB/s
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
** Programming Finished **
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
shutdown command invoked
Terminate batch job (Y/N)? y


I then have to press ctrl+c about and get out from the batch file again. The verify is never starter.
Searching for similar issue, it seems it is the "failed to get flash maps" that could be the problem.
It does not matter if I run at 20MHz or 200kHz.
I have to say that it looks like the programming is okay (I can change the application), but the problem is that I have to about manually with ctrl+c to continue.

Any idea why I get this error ?

Kind regards, Claus

zfields
Posts: 3
Joined: Thu Aug 27, 2020 12:20 am

Re: Failed to get flash mappings (-4)

Postby zfields » Thu Jun 30, 2022 2:54 pm

I ran into a similar problem.

The reason I was getting this warning is because I had erased the secondary bootloader and partition table using `esptool.py erase_flash`.

Then I was using OpenOCD to try and write the application back to the ESP32. OpenOCD requires the partition table to determine the flash mappings, so you end up in a "chicken or the egg" scenario.

To fix my problem, I needed to flash my application directly over USB. This mechanism utilizes the primary bootloader, and restores the secondary bootloader and the partition table.

After that I was able to flash my application via OpenOCD again.

Who is online

Users browsing this forum: No registered users and 46 guests