I've seen a good number of guides now on OTA updates, but none that quite fits what I want to do.
I have an Arduino Mega as the main MCU in a project, and it has both SPI and UART connections to an ESP12 module. Currently the Arduino does "some stuff", periodically sends a JSON over to the ESP, which sends it out using MQTT over WiFi. The ESP handles all network related stuff.
What I'd like to do is send an Arduino hex to the ESP, store it and verify it on the ESP, then flash the Arduino with it. The ESP currently has custom software running on it, so I was hoping this functionality can be added to it somehow, but I'm not really sure what first steps to take.
I guess I want to reset and trigger the bootloader on the Arduino and then shove the hex over serial or something, but I have no idea the format that needs to take. Any tips?