r28/29 cannot be used in asm here

I’m trying to customize and compile the arduino bootloader acquired from http://www.ladyada.net/library/arduino/ATmegaBOOT_168.c using AVR Studio 5 and keep running into errors, however I’ve got it down to just two: “r28 cannot be used in asm here” and “r29 cannot be used in asm here”. The line it mentions is actually the end brace of main but I narrowed the problem down to this line : "=m" (SPMCSR) : "M" (PAGE_SIZE) : "r0","r16","r17","r24","r25","r28","r29","r30","r31"

r28 and r29 are the high and low fields of the Y-pointer? Why wouldn’t It allow me to use them in main?

Any help would be appreciated

Attached is the full code I’m working with as it wouldn’t allow me to post it (9500 character post limit)

Bootloader.c (17.9 KB)

Your Bootloader.c compiles file in the Arduino IDE.

AVR Freaks to the rescue! Turns out I needed to enable optimizations.