# Confusion over ESP32 bootloader file

**URL:** <https://forum.embeetle.com/t/confusion-over-esp32-bootloader-file/457>\
**Category:** Uncategorized\
**Created:** [April 18, 2021, 1:27pm UTC](https://forum.embeetle.com/t/confusion-over-esp32-bootloader-file/457 "2021-04-18T13:27:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kristof](https://forum.embeetle.com/user_avatar/forum.embeetle.com/kristof/32/7_2.png) [@kristof](https://forum.embeetle.com/u/kristof)\
**Post date:** [April 18, 2021, 1:27pm UTC](https://forum.embeetle.com/t/confusion-over-esp32-bootloader-file/457/1 "2021-04-18T13:27:31Z")

</div>

The ESP32 flash command, as executed by the Arduino IDE, seems to flash two bootloader files: one at offset `0xe000` and another at offset `0x1000`. I wonder what these two bootloader files actually do, and why there are two of them. Below I give some more context.

# 1. Arduino IDE flash procedure for ESP32 projects

After building the `.elf` file, the Arduino IDE launches a command to convert it into a binary:

```sh
python esptool.py --chip esp32 elf2image
                  --flash_mode dio
                  --flash_freq 80m
                  --flash_size 4MB
                  -o /tmp/arduino_build_852524/WiFiScan.ino.bin
                  /tmp/arduino_build_852524/WiFiScan.ino.elf

```

Finally, this `WiFiScan.ino.bin` file is flashed to the board, alongside two bootloader files and the partitions table:

```sh
python esptool.py --chip esp32
                  --port /dev/ttyUSB0
                  --baud 921600
                  --before default_reset
                  --after hard_reset write_flash
                  -z
                  --flash_mode dio
                  --flash_freq 80m
                  --flash_size detect
                  0xe000 ~/.arduino15/packages/esp32/hardware/esp32/1.0.6/tools/partitions/boot_app0.bin
                  0x1000 ~/.arduino15/packages/esp32/hardware/esp32/1.0.6/tools/sdk/bin/bootloader_dio_80m.bin
                  0x10000 /tmp/arduino_build_852524/WiFiScan.ino.bin
                  0x8000 /tmp/arduino_build_852524/WiFiScan.ino.partitions.bin

```

The default partitions table, as used by Arduino IDE, looks like this (in csv format):

```plaintext
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xe000, 0x2000,
app0, app, ota_0, 0x10000, 0x140000,
app1, app, ota_1, 0x150000,0x140000,
spiffs, data, spiffs, 0x290000,0x170000,

```

The two bootloader files being flashed are:

```auto
# flashed at 0xe000
~/.arduino15/packages/esp32/hardware/esp32/1.0.6/tools/partitions/boot_app0.bin

```

and:

```auto
# flashed at 0x1000
~/.arduino15/packages/esp32/hardware/esp32/1.0.6/tools/sdk/bin/bootloader_dio_80m.bin

```

I wonder what these two bootloader files are actually doing. It’s also interesting to observe their locations. The first one, `boot_app0.bin` is located in a folder named `'partitions'`. It sits there alongside several partition `.csv` files. Why?

The other one, `bootloader_dio_80m.bin` is located in a folder named `'sdk/bin/'` and sits alongside other files that all start their name with the `'bootloader_'` prefix:

 ![image](https://forum.embeetle.com/uploads/default/original/1X/c536dbe4767eca7cd1c37a8d6e239b25e11d1344.png)
