Skip to content

Commit 83fab13

Browse files
iMartyncmaglie
authored andcommitted
Bootloaders: wrong #ifdefs, should be defined() not just tested (i.e. noteq 0)
Close #126
1 parent d76d58a commit 83fab13

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

bootloaders/atmega/ATmegaBOOT_168.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@ int main(void)
682682
"rjmp write_page \n\t"
683683
"block_done: \n\t"
684684
"clr __zero_reg__ \n\t" //restore zero register
685-
#if defined __AVR_ATmega168__ || __AVR_ATmega328P__ || __AVR_ATmega328__ || __AVR_ATmega128__ || __AVR_ATmega1280__ || __AVR_ATmega1281__
685+
#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega328__) || defined(__AVR_ATmega128__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega1281__)
686686
: "=m" (SPMCSR) : "M" (PAGE_SIZE) : "r0","r16","r17","r24","r25","r28","r29","r30","r31"
687687
#else
688688
: "=m" (SPMCR) : "M" (PAGE_SIZE) : "r0","r16","r17","r24","r25","r28","r29","r30","r31"
@@ -715,7 +715,7 @@ int main(void)
715715
putch(0x14);
716716
for (w=0;w < length.word;w++) { // Can handle odd and even lengths okay
717717
if (flags.eeprom) { // Byte access EEPROM read
718-
#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega328__)
718+
#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega328__)
719719
while(EECR & (1<<EEPE));
720720
EEAR = (uint16_t)(void *)address.word;
721721
EECR |= (1<<EERE);
@@ -931,7 +931,7 @@ void putch(char ch)
931931
while (!(UCSR1A & _BV(UDRE1)));
932932
UDR1 = ch;
933933
}
934-
#elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined (__AVR_ATmega328__)
934+
#elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined (__AVR_ATmega328__)
935935
while (!(UCSR0A & _BV(UDRE0)));
936936
UDR0 = ch;
937937
#else

bootloaders/bt/ATmegaBOOT_168.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ putch(0x0D);
680680
"rjmp write_page \n\t"
681681
"block_done: \n\t"
682682
"clr __zero_reg__ \n\t" //restore zero register
683-
#if defined __AVR_ATmega168__ || __AVR_ATmega328P__ || __AVR_ATmega_328__
683+
#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega_328__)
684684
: "=m" (SPMCSR) : "M" (PAGE_SIZE) : "r0","r16","r17","r24","r25","r28","r29","r30","r31"
685685
#else
686686
: "=m" (SPMCR) : "M" (PAGE_SIZE) : "r0","r16","r17","r24","r25","r28","r29","r30","r31"
@@ -712,7 +712,7 @@ putch(0x0D);
712712
putch(0x14);
713713
for (w=0;w < length.word;w++) { // Can handle odd and even lengths okay
714714
if (flags.eeprom) { // Byte access EEPROM read
715-
#if defined __AVR_ATmega168__ || __AVR_ATmega328P__ || __AVR_ATmega328__
715+
#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega328__)
716716
while(EECR & (1<<EEPE));
717717
EEAR = (uint16_t)(void *)address.word;
718718
EECR |= (1<<EERE);

0 commit comments

Comments
 (0)