Porting the bootloader and core for other AVRs

I took a look at what changes would be necessary to modify the bootloader and the core code to run on a mega644. The required changes are pretty minimal and they can be done to allow easier porting to other AVRs in the future. For example, in a dozen or so places, there is conditional code to handle the differences in register/bit names between the older processors and the newer ones. In many cases, these changes are controlled with a conditional like this:

#if defined(__AVR_ATmega168__)

With other AVR projects, I've used the existence of the new register name to control which code is used like this:

#if defined(UCSR0A)
    while (!(UCSR0A & _BV(UDRE0)));
        UDR0 = ch;
#else
    while (!(UCSRA & _BV(UDRE)));
        UDR = ch;
#endif

I also added the signature byte definitions for several likely AVR targets (mega644, mega644P, mega1284P, mega328P and mega168P) and a way to control the blink time from the build script.

I don't see a way to attach a file to a post so I've put a diff script for the changes to bootloader on my website.

[edit: added link for diff script] http://www.kinzers.com/don/mega644_BOOT_changes.dif

I'll have a similar set of changes for the core code shortly.

Don Kinzer

Hi Don. You may want to check out the sanguino. http://sanguino.cc/

Thanks, I've seen the information on the Sanguino. My purpose in posting was to provide input for improving the Arduino software.