I want to be able to upload a hex file to an Atmega2560 from an ESP8266 with an attached SD Card. Since the target is a 2560 I know have to use v2 of the STK500 protocol. Additionally, I want to be able to upload the code using the bootloader on the 2560 over TTL serial. Not over ICSP (SPI). The reason is I don't have enough free pins on the ESP8266 to bit bang SPI.
So I've found two almost complete solutions to solve my problem:
It will program an Atmega2560 using STK500v2. However, the problem is that it uses SPI not normal serial.
It uploads over TTL serial, but does not use the v2 protocol so it can't program a 2560.
So is uploading using the bootloader over TTL versus ICSP(SPI) almost the same thing (eg command codes and sequence) or significantly different? I know the the reset sequence is somewhat different. Also, I'm kinda stuck on terminology. Is uploading a hex file via a bootloader still called ICSP?
Right now I'm working on changing Nick Gammon's code from SPI to TTL serial. But, I'm not entirely sure this is the correct approach. Any thoughts would be helpful. Thanks.