Originally published at: How to do ESP32 OTA Updates using Golioth and ESP-IDF - Golioth
The most sought-after Golioth feature is OTA, also known as Over-the-Air firmware updates. When you put an IoT device into the field it’s crucial that you be able to push firmware updates to it without human intervention. Golioth makes simplifies the process for your ESP-IDF projects. Today we’re walking through the OTA process: Build and flash the initial firmware to the device Provision the device with credentials that will be persistent across firmware updates Build a new revision of the firmware Upload the firmware to Golioth and roll it out as a release Observe the device detecting, downloading, and running the new firmware Prerequisites: Please ensure that you have installed a copy of the the ESP-IDF v4.4.2 to your computer. Today’s article will use an ESP32 but this will work with other variants like the ESP32s2, ESP32c3, etc. Clone a copy of the Golioth Firmware SDK (which includes ESP-IDF support). To do, please follow the “Cloning this repo section” in the README. Commands in this guide are based on a Linux operating system with the ESP-IDF and Golioth Firmware SDK installed in the home directory (~/). However, these are cross-platform tools and are easy to adapt to your system and your preferred install directories. Build and flash the initial firmware In a classic Chicken-or-Egg scenario, to perform a Golioth OTA update your device needs to be running firmware built for Golioth OTA. We can use the golioth_basics example which is ready to run without changes. First, let’s make sure our ESP-IDF is set to the correct version and enabled for this session: cd ~/esp-idf git fetch git checkout v4.4.2 git submodule update --init --recursive ./install.sh all source export.sh Now move…