Last active
May 23, 2023 21:04
-
-
Save abythell/5145472 to your computer and use it in GitHub Desktop.
Arduino Pro Mini Bootloader Patch. Fixes EEWE compiler errors and adjusts the Makefile to use an STK500 programmer on /dev/ttyS0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/hardware/arduino/bootloaders/atmega/ATmegaBOOT_168.c b/hardware/arduino/bootloaders/atmega/ATmegaBOOT_168.c | |
index 2b9fefa..046de0c 100755 | |
--- a/hardware/arduino/bootloaders/atmega/ATmegaBOOT_168.c | |
+++ b/hardware/arduino/bootloaders/atmega/ATmegaBOOT_168.c | |
@@ -580,7 +580,7 @@ int main(void) | |
/* 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 | |
-#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega1281__) | |
+#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega1281__) || defined(__AVR_ATmega328P__) | |
while(bit_is_set(EECR,EEPE)); //Wait for previous EEPROM writes to complete | |
#else | |
while(bit_is_set(EECR,EEWE)); //Wait for previous EEPROM writes to complete | |
diff --git a/hardware/arduino/bootloaders/atmega/Makefile b/hardware/arduino/bootloaders/atmega/Makefile | |
index 0fd54db..89aff44 100755 | |
--- a/hardware/arduino/bootloaders/atmega/Makefile | |
+++ b/hardware/arduino/bootloaders/atmega/Makefile | |
@@ -21,7 +21,7 @@ PROGRAM = ATmegaBOOT_168 | |
# enter the parameters for the avrdude isp tool | |
ISPTOOL = stk500v2 | |
-ISPPORT = usb | |
+ISPPORT = /dev/ttyS0 | |
ISPSPEED = -b 115200 | |
MCU_TARGET = atmega168 | |
@@ -49,7 +49,7 @@ STK500-2 = $(STK500) -d$(MCU_TARGET) -ms -q -lCF -LCF -cUSB -I200kHz -s -wt | |
OBJ = $(PROGRAM).o | |
-OPTIMIZE = -O2 | |
+OPTIMIZE = -Os | |
DEFS = | |
LIBS = |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment