Hello!
I have a project where I am using an atmega 2560 chip on a board done by me that monitors enviromental conditions and stores the data in an SD card. I upload the code with avrdudes and a usb avrisp xp2 but since i have some of them placed and it would be nice to just go around with an sd card to update any firmware instead of the whole cable and pc, and I have seen this should be possible.
For what i have tried I should load first the bootloader from MicroBridge to my device with the correct fuse bites (BOOTRST selected) and then load my device code with the disable flash erase (-D) selected so the bootloader is not deleted when flashing the device again... The fuse bites I am using L=0xC0 H=0xD8 E=0xFD LB=0xFF (I am using an external clock that is why low fuse is set like that) Also the the SD pins i am using are the same as the ISP bootloader says.
The bootloader i have tried loading is the stk500boot.hex file in the repository, then loading my code .hex file by disabling the flash erase while programming. And then the file that i am using afterwards in the SD card is the .BIN file that the arduino generates in the sketches folder and change the name to FIRMWARE.BIN:
You might want to contact @pert and others who participated in the thread to see if they can help.
I've never used a 2560, so can't really offer any advice. But if your project is anything like the one I did for the MSP430, you want the bootloader to first check the SD card for the presence of a particular filename, and if found, flash the new firmware from the card into the 2560. But do that only once.
It's not clear from your description where you are stuck. Are you able to write your revised bootloader to the 2560? Does it operate as a normal bootloader if the file is not present?
Ok, I managed to make it work finally after trying a bit more . And it seems to be working perfectly. Just had to follow instructions carefully. It seems like i was loading the wrong .bin file, I had to convert the hex file without bootloader with the cmd screen with avr-objcopy -I ihex -O binary RECEIVER_FINAL.ino.hex firmware.bin and load that to the sd card. Thanks for answering by the way!