Flash Arduino mega 2560 over wifi using ESP8266-12f - £100+ paid work

Hello i have been trying to find the best way to flash my Arduino Mega 2560 over wifi using an ESP8266-12.

I have found two sketches that i can get working perfectly on a Uno just not a aMega, the first is called BootDrive but uses an SD card and STK500v1 instead of v2 but i can not figure out how i could adjust it, so it reads data from a server, using GET, i can easily print out the HEX file stored on my server in the arduino serial monitor, but i would then need to store it to the EEPROM or Flash of the ESP so i can then read it line by line quickly and that above my coding skills.

And the second is some Spanish persons sketch which uses Python and flashes over a TCP transparent connection from my pc to the ESP and sends the data over serial to the Mega, but it uses STK500v1 and so i had to use the stk500v1 and flash Optiboot to my Mega but that limited the pins and other functions to the scope of a 328p, AND the sketch runs on the Arduino to be flashed so if the TCP connection drops a packet the Flash fails and the Mega then needs to be re flashed via the IDE which is not ideal, just imagine this is a final product and can not be associated with Arduino IDE or command prompt and so on it must be very easy to update and 100% reliable.

Lastly i have found ESP-Link which looks very promising but from what i can see it takes up the entire ESP's resources, rather than being a arduino based sketch. This is not acceptable as i already have an Arduino sketch running on the ESP which reads data sent from the Mega over serial to the ESP and then sends that data to a server to be inserted into a database.

Concluding on all that, I have not found any thing that meets my needs, being get the hex file from a server or local pc and sending it to the ESP which in turn flashes the Arduino Mega 2560, without the need for Python or Command Prompt or a SD card, the ESP has 4Mb of Flash or EEPROM so that could be used to store the 296Kb HEX file if needed.

So after explaining my issue, can any one here write or modify a code to do what i want for paid work ? All it needs to do is connect to the server get the hex file save it to EEPROM and then just modify the BootDrive code so instead it reads the EEPROM rather than from a SD card.

Cheers From Kawasaki

Have you seen this? It's probably a lot easier than doing everything in C/C++. https://learn.adafruit.com/stand-alone-programming-avrs-using-circuitpython?view=all

Pieter

KawasakiZx10r: flash Optiboot to my Mega but that limited the pins and other functions to the scope of a 328p

That's not a limitation imposed by Optiboot. I can't imagine how you ended up in that situation.

The easiest way to use optiboot with a Mega 2560 is MegaCore: https://github.com/MCUdude/MegaCore Now I understand that getting optiboot working on the board without restrictions is not necessarily the solution to your problem but I thought I should clear up that misconception.

If you use the ESP8266 to flash the Mega 2560 over serial via the bootloader it shouldn't make any difference which serial bootloader is on there.

EEPROM on the ESP8266 is simulated for Arduino compatibility.

What you’re looking for to replace the SD card is SPIFFS - a built-in file system taking 1 MB or 3 MB of the available flash, indeed more than enough to store that file.