Hi there.
Friends, can anybody advice me how to do the application that is able to erase itself in the ESP32-WROOM-32 flash memory, or (and this is better) can bring the ESP32-WROOM-32 to the its default factory state.
I don't ask for a solution, but asking for the advice how is better to do that. And is it possible at all?
How to erase the application directly from... itself?
-
- Posts: 9715
- Joined: Thu Nov 26, 2015 4:08 am
Re: How to erase the application directly from... itself?
That's a bit of a strange question; what's your end goal with this?
Re: How to erase the application directly from... itself?
Why is strange? The goal of this is quite simple.
On some assembled devices I run my own test software. But my customer wants to get the devices (esp32 firmware) in the state like "from factory".
I don't want to disassemble all mechanical parts and erase esp32 by pc connection, because is better to push some key and erase all to the initial state using my firmware. And also don't want to discuss with my customer.
Seems like SPI Flash API is enough for this task. Am I right?
On some assembled devices I run my own test software. But my customer wants to get the devices (esp32 firmware) in the state like "from factory".
I don't want to disassemble all mechanical parts and erase esp32 by pc connection, because is better to push some key and erase all to the initial state using my firmware. And also don't want to discuss with my customer.
Seems like SPI Flash API is enough for this task. Am I right?
-
- Posts: 9715
- Joined: Thu Nov 26, 2015 4:08 am
Re: How to erase the application directly from... itself?
Well, it's a bit strange that your customers insist on a certain firmware in the flash, especially because 'from the factory' code isn't always useful or up-to-date. Anyway, you could try to use the SPI flash routines, but note that there is a pretty large chance that will fail: the ESP32 executes code directly from flash (via XIP) and erasing the flash would erase your running program as well. You can try to work around this by putting relevant routines in IRAM instead, but I'm not sure if it's possible to put enough code in IRAM to do what you need to do.
Re: How to erase the application directly from... itself?
Can you please tell me, Core 0 is APP_CPU or PRO_CPU?
Re: How to erase the application directly from... itself?
Flash erase commands are already in iram and chip erase is a single command so I don't see why not. It doesn't get you back to factory firmware though. Also doesn't really make sense that the customer will then have to disassemble the devices to flash them.
Re: How to erase the application directly from... itself?
Maybe its some misunderstanding here, what exactly "factory reset" means? Is it reset to state esp32 module is leaving factory or your device is leaving factory and is sent to client?
Re: How to erase the application directly from... itself?
The buffers are disabled for both cores. Interrupts also disabled. I working from IRAM now. Most of all I'll try to easy write to the SPI via registers. Because spi_flash functions are not working now for some reason. As for customers... When we have "stupid" task we have to do it like any other task. Thanks alot for answers
p.s. Now the task is to erase application in the ESP32 flash.
p.s. Now the task is to erase application in the ESP32 flash.
Who is online
Users browsing this forum: Marcosss and 50 guests