Removing the bootloader?

Hi,

I am discovering the Arduino world and I would like to develop an application based on Arduino ESP32, using the Deep-Sleep mode.
I would wake up the board every minute, to simply run for a few milliseconds.
I am using ArduinoIDE version 2.

I managed to make the deep-sleep mode work, with a timer wake-up.

However, every time, the bootloader takes 1-2 seconds, before my sketch is actually run. So it takes a lot of battery life for nothing.

Is there a way to make sure that, when the board wakes up, only my sketch executes, and NOT the bootloader?

Even having read many web pages of documentation regarding the way Arduino works (uploading, bootloader, ...), these things are still a bit unclear to me. I don't understand well the differences between ArduinoIDE, Platformio, ESP-IDF. I don't understand what is developed by Espressif, what is developped by Arduinio, etc. Could you please point me to some websites explaining the various concepts?

Many thanks!

are you sure you need such powerful board with 32bit chip? will you not happy with ATtiny? actual models are very energy saving.

@kolaha, thanks! Well, I need to have Bluetooth LE onboard, and the pre-packaged Nano ESP32 board would save me a lot of time rather than integrating various electronical components. The Nano form factor is also quite convenient for my project.

I think Deep Sleep by design causes a reboot on wakeup. How would you propose your application to be loaded after a reboot without a bootloader?

Thanks gfvalvo! Don't really know, but for instance, the might be a switch on the board to branch the execution at boot time, either to the bootloader, or to the application.

Indeed from the docs I read, Deep Sleep does cause a reboot on wakeup.

But I find it weird, that for apps in production, the bootloader still executes, while it has become useless. Is there a way to flash my own app so that it directly executes at reboot?

I have actually read this document: https://www.instructables.com/Overview-the-Arduino-sketch-uploading-process-and-/

It looks like we can program an Arduino via the ISP mode (In-Circuit Serial Programming). By doing this, the uploaded sketch replaces the bootloader (meaning we then need to upload other sketches via ISP as well).

The ESP32 has a substantially different "boot" behavior than the AVR Arduinos.
I don't know if you can reduce the startup time below the 1-2s you are seeing - I'm not sure if that's the "bootloader" or just the startup process for the FreeRTOS and radio code that time.
(You might get some idea by monitoring the Serial port. I think there is substantial startup text output there, perhaps at weird bit rates.)

(In any case, nothing you read about removing the bootloader from an Uno, Nano v3, or Mega is applicable to an ESP board.)

2 Likes