Pages: [1]   Go Down
Author Topic: need info on how to port Arduino Mega bootloader  (Read 364 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 11
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm developing a product that is similar to the arduino mega.  I'm considering using the atmega 640 to save on cost, but I'm having trouble tweaking the arduino Mega bootloader for the 640.  It seems simple due to the chips being nearly identical, but I've run into problems.  1 I found there is an instruction ELPM not available on the 640. This seems to be preventing the bootloader code from being a simple port via a few defines.  I wondering if anyone could explain what portion of the bootloader code I have to adjust in order to make the 640 work.  I believe that the elpm instruction deals with extended memory.

I think this is the problem code
Code:
#if defined(__AVR_ATmega128__) || defined(__AVR_ATmega1280__)  || defined(__AVR_ATmega640__) || defined(__AVR_ATmega1281__)
                        RAMPZ = address_high;
#endif
                        address.word = address.word << 1;              //address * 2 -> byte location
                        /* if ((length.byte[0] & 0x01) == 0x01) length.word++;      //Even up an odd number of bytes */
                        if ((length.byte[0] & 0x01)) length.word++;      //Even up an odd number of bytes
                        cli();                              //Disable interrupts, just to be sure

I don't think the RAMPZ register is available in the atmega640 which is why I think the elpm instruction does not exist.  I only generally know what going on here any help would be greatly appreciated.
Logged

Pages: [1]   Go Up
Jump to: