Migrate from Arduino to ESP-IDF

poneponecar
Posts: 4
Joined: Sun Apr 03, 2022 11:56 am

Migrate from Arduino to ESP-IDF

Postby poneponecar » Sun Apr 03, 2022 12:17 pm

Hi,
I am now trying to work out a solution to migrate existing ESP32 devices with Arduino based firmware to the ESP-IDF based firmware.
It has to be done in the OTA method since there are already several devices in the field and it is quite difficult to collect them and update the firmware manually.
My first trial was quite naïve, simple use the OTA method to update the new binary, and it bricked my device.
And I found out that the Arduino bootloader is not compatible with the ESP-IDF based application.
Then I read the source code of the Update related part in the Arduino environment, and it seemed to be impossible to update the bootloader (location at 0x1000) with the existing API.
So I am now thinking another way to do so:
Keep the Arduino bootloader(@0x1000), and since the Arduino bootloader would jump to application binary at 0x10000, flash the ESP-IDF bootloader to 0x10000. So the Arduino bootloader would execute the ESP-IDF bootloader.
And in the partition table of the ESP-IDF based project, set the 'real' application binary location to 0x150000, and also flash the ESP-IDF based firmware binary to this location. So the ESP-IDF bootloader should be able to find it and execute the application.

Did someone already tried this way? Or is it feasible?
Every suggestion would be highly appreciated.
Thanks!

poneponecar
Posts: 4
Joined: Sun Apr 03, 2022 11:56 am

Re: Migrate from Arduino to ESP-IDF

Postby poneponecar » Tue Apr 05, 2022 8:52 am

After directly flash the ESP-IDF app into the device which has Arduino bootloader.
The app hangs after APP cpu up
Image

After some investigation, it hangs in ESP-IDF cpu_start.c:

Code: Select all

#if CONFIG_IDF_TARGET_ESP32
#if !CONFIG_SPIRAM_BOOT_INIT
    // If psram is uninitialized, we need to improve some flash configuration.
    bootloader_flash_clock_config(&fhdr);
    bootloader_flash_gpio_config(&fhdr);
    bootloader_flash_dummy_config(&fhdr);
    bootloader_flash_cs_timing_config();
#endif //!CONFIG_SPIRAM_BOOT_INIT
#endif //CONFIG_IDF_TARGET_ESP32
If I mark these four lines, and rebuild the app. Then the ESP-IDF app could successfully boot up with the Arduino SPL.
Could someone suggest if it is safe to do so?

seppel123
Posts: 11
Joined: Fri Jan 14, 2022 2:08 pm

Re: Migrate from Arduino to ESP-IDF

Postby seppel123 » Fri Jul 15, 2022 9:03 am

Hi did u found a solution for this problem i facing the same atm and looking for someone with experiance here. :D

Who is online

Users browsing this forum: top_secret_guy and 90 guests