OpenOCD ESP32 - Erase
OpenOCD ESP32 - Erase
Hi all,
I don't know if this is the right section of the forum to post my question, and I apologize in advance if it isn't...
I am using OpenOCD to program my ESP32 Dev Kit. And so far, I seem to do good progress. I am using the openocd_esp32 on the espressif GitHUb (https://github.com/espressif/openocd-esp32).
Now, I am facing an issue when it comes to purely and simply erase the entire flash of the ESP32 using OpenOCD... I've tried a couple of different things (like, for example, -c "esp32 mass_erase 0" like I was used to do with the stm or nordic chips for example); but nothing works... I checked the esp32.c file located in openocd-esp32/src/flash/nor/esp32.c and I've noticed "mass_erase" was implemented unfortunately... But now, I have no idea on how to accomplish a full erase without programming using OpenOCD...
Has anyone an idea on how to do this? It is very important that I use openOCD to do this (because I know that it can be done using the esp_idf with the command make erase_flash; but I must use OpenOCD, so I can't use that other way...)
Thanks!
I don't know if this is the right section of the forum to post my question, and I apologize in advance if it isn't...
I am using OpenOCD to program my ESP32 Dev Kit. And so far, I seem to do good progress. I am using the openocd_esp32 on the espressif GitHUb (https://github.com/espressif/openocd-esp32).
Now, I am facing an issue when it comes to purely and simply erase the entire flash of the ESP32 using OpenOCD... I've tried a couple of different things (like, for example, -c "esp32 mass_erase 0" like I was used to do with the stm or nordic chips for example); but nothing works... I checked the esp32.c file located in openocd-esp32/src/flash/nor/esp32.c and I've noticed "mass_erase" was implemented unfortunately... But now, I have no idea on how to accomplish a full erase without programming using OpenOCD...
Has anyone an idea on how to do this? It is very important that I use openOCD to do this (because I know that it can be done using the esp_idf with the command make erase_flash; but I must use OpenOCD, so I can't use that other way...)
Thanks!
-
- Posts: 190
- Joined: Wed Jan 24, 2018 6:51 am
Re: OpenOCD ESP32 - Erase
I think it should be possible using `flash erase_sector` command,
Please note that, sector 0 erase is not supported, protected considering any secure boot related data there. Ref: https://github.com/espressif/openocd-es ... p32.c#L663flash probe 0
flash erase_sector 0 1 1023
Mahavir
https://github.com/mahavirj/
https://github.com/mahavirj/
Re: OpenOCD ESP32 - Erase
Hi,
Thanks for your reply.
I've tried.; but it gives me the error:
This is the exact command I am running, if anyone knows what might be wrong...?
Many thanks!
Thanks for your reply.
I've tried.; but it gives me the error:
Code: Select all
invalid subcommand "erase_sector"
Code: Select all
/usr/local/esp/openocd/bin/openocd -s /usr/local/esp/openocd/share/openocd/scripts \
-f interface/ftdi/jtag_esp32.cfg \
-f target/esp32.cfg \
-c "flash erase_sector 0x1000 exit"
-
- Posts: 24
- Joined: Fri Dec 02, 2016 8:55 pm
Re: OpenOCD ESP32 - Erase
Hi,fmuller1 wrote:Hi,
Thanks for your reply.
I've tried.; but it gives me the error:This is the exact command I am running, if anyone knows what might be wrong...?Code: Select all
invalid subcommand "erase_sector"
Many thanks!Code: Select all
/usr/local/esp/openocd/bin/openocd -s /usr/local/esp/openocd/share/openocd/scripts \ -f interface/ftdi/jtag_esp32.cfg \ -f target/esp32.cfg \ -c "flash erase_sector 0x1000 exit"
You need to run openocd with the following command:
Code: Select all
/usr/local/esp/openocd/bin/openocd -s /usr/local/esp/openocd/share/openocd/scripts \
-f interface/ftdi/jtag_esp32.cfg \
-f target/esp32.cfg \
-c "init; reset halt; flash erase_address 0x1000 4096; exit"
For more information on available OpenOCD flash commands and their parameters please, see http://openocd.org/doc/html/Flash-Comma ... ngcommands
Re: OpenOCD ESP32 - Erase
Great! This command works like a charm!
Thanks to both for your help!
Thanks to both for your help!
-
- Posts: 11
- Joined: Mon Jun 05, 2017 7:50 pm
Re: OpenOCD ESP32 - Erase
Apologies for hijacking, but might you share which device you're using to talk to the ESP over?
(I'd like to get OpenOCD to work with my Adafruit Feather, and understand that I need an adapter
to connect to the JTAG. Would you recommend the one you're using?)
Thanks!
Hamish
(I'd like to get OpenOCD to work with my Adafruit Feather, and understand that I need an adapter
to connect to the JTAG. Would you recommend the one you're using?)
Thanks!
Hamish
Re: OpenOCD ESP32 - Erase
Hi Hamish,
I am using FT2232H Mini Module to program the ESP32 using openocd_esp32 and the JTAG pins.
Works great for me! But I am using the ESP32-DevKitC, and I am not familiar with the Arduino Feather; so I am unsure of its pin breakout...
Hope that helps!
I am using FT2232H Mini Module to program the ESP32 using openocd_esp32 and the JTAG pins.
Works great for me! But I am using the ESP32-DevKitC, and I am not familiar with the Arduino Feather; so I am unsure of its pin breakout...
Hope that helps!
-
- Posts: 11
- Joined: Mon Jun 05, 2017 7:50 pm
Re: OpenOCD ESP32 - Erase
Thank you!
-
- Posts: 151
- Joined: Thu Jun 15, 2017 4:54 am
- Location: New Zealand
Re: OpenOCD ESP32 - Erase
I've also had JTAG debug/flash programming success on the ESP32 with this one:
http://www.ftdichip.com/Support/Documen ... _CABLE.PDF
It's based on the FTDI FT232H device.
http://www.ftdichip.com/Support/Documen ... _CABLE.PDF
It's based on the FTDI FT232H device.
Who is online
Users browsing this forum: Baidu [Spider], Bing [Bot] and 113 guests