BonaDrone/Hackflight

Program the ESP32 from the platform

Closed this issue · 1 comments

Feature / Bug description

Make sure that the ESP32 can be programmed from the platform and that the Arduino IDE is not needed at all.

Expected behavior

A way to program the ESP32 avoiding the Aduino IDE is found.

TLDR; it is possible to do so.

Note: What we should look for is a way of automating the following steps from the platform.

Detailed HOW-TO

This is actually possible and not really difficult if you have a Python interpreter in your machine. Under the two following assumptions,

  1. The program running on the board is the ESP32_flash_loader.
  2. The compiled binaries of the program to be flashed into the ESP32 have already been generated with the Arduino IDE.

the procedure I followed to achieve so is:

  1. Copy the files FILE_NAME.ino.bin and FILE_NAME.ino.partitions.bin from the temporary folder where the Arduino IDE places them upon compilation to any folder you want.
  2. Copy the files /home/USERNAME/.arduino15/packages/esp32/tools/esptool/2.3.1/esptool.py, /home/USERNAME/.arduino15/packages/esp32/hardware/esp32/1.0.0/tools/partitions/boot_app0.bin and /home/USERNAME/.arduino15/packages/esp32/hardware/esp32/1.0.0/tools/sdk/bin/bootloader_dio_80m.bin into the same folder where you copied the binaries in 1. Note that USERNAME should be replaced by your username in your machine.
  3. Open a terminal session in the folder where you have placed all the files from 1 and 2 and run: python esptool.py --chip esp32 --port /dev/ttyACM0 --baud 115200 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size detect 0xe000 boot_app0.bin 0x1000 bootloader_dio_80m.bin 0x10000 FILE_NAME.ino.bin 0x8000 FILE_NAME.ino.partitions.bin

The next screenshot shows the output from executing 3. As it can be seen, the program is flashed seamlessly.

selection_064