Skip to content

Instantly share code, notes, and snippets.

@abythell
Last active May 23, 2023 21:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abythell/5145472 to your computer and use it in GitHub Desktop.
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
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