From 91e55f26c80ebb2c9a4c5257e14347626120d569 Mon Sep 17 00:00:00 2001 From: Jonathan Vetter Date: Wed, 29 Sep 2021 00:37:13 +0200 Subject: [PATCH] Add bigboot support to USB-MCUs and correct wrong bootsize for atmega16u4 --- .../bootloaders/optiboot/Makefile.usbmcus | 222 ++++++++++++++++-- .../bootloaders/optiboot/makeall.usbmcus.sh | 4 + optiboot/bootloaders/optiboot/makeoptions | 24 ++ optiboot/bootloaders/optiboot/pin_defs.h | 14 +- 4 files changed, 248 insertions(+), 16 deletions(-) diff --git a/optiboot/bootloaders/optiboot/Makefile.usbmcus b/optiboot/bootloaders/optiboot/Makefile.usbmcus index 99377c5..4a786b7 100644 --- a/optiboot/bootloaders/optiboot/Makefile.usbmcus +++ b/optiboot/bootloaders/optiboot/Makefile.usbmcus @@ -22,8 +22,12 @@ HELPTEXT += "target atmega8/16/32u2, atmega16/32u4 - newer 32/44pin AVR-USB-MCUs atmega8u2atUART: TARGET = atmega8u2 atmega8u2atUART: MCU_TARGET = atmega8u2 atmega8u2atUART: CFLAGS += $(COMMON_OPTIONS) $(UART_CMD) -atmega8u2atUART: AVR_FREQ ?= 16000000L +atmega8u2atUART: AVR_FREQ ?= 16000000L +ifndef BIGBOOT ## standard version is 512 Bytes long; starts earlier atmega8u2atUART: LDSECTIONS = -Wl,--section-start=.text=0x1e00 -Wl,--section-start=.version=0x1ffe +else ## bigboot version is 1024 Bytes long; starts earlier +atmega8u2atUART: LDSECTIONS = -Wl,--section-start=.text=0x1c00 -Wl,--section-start=.version=0x1ffe +endif atmega8u2atUART: $(PROGRAM)_atmega8u2_UART$(UART)_$(BAUD_RATE)_$(AVR_FREQ).hex ifndef PRODUCTION atmega8u2atUART: $(PROGRAM)_atmega8u2_UART$(UART)_$(BAUD_RATE)_$(AVR_FREQ).lst @@ -34,7 +38,11 @@ atmega8u2: atmega8u2_isp: atmega8u2 atmega8u2_isp: TARGET = atmega8u2 atmega8u2_isp: MCU_TARGET = atmega8u2 -atmega8u2_isp: HFUSE ?= DE# = 512 byte boot, JTAG disabled +ifndef BIGBOOT ## standard version is 512 Bytes long; starts earlier +atmega8u2_isp: HFUSE ?= DE# = 512 byte boot, SPI (ISP!!!) enabled, JTAG disabled +else ## bigboot version is 1024 Bytes long; starts earlier +atmega8u2_isp: HFUSE ?= DC# = 1024 byte boot, SPI (ISP!!!) enabled, JTAG disabled +endif atmega8u2_isp: LFUSE ?= FF# = Full Swing xtal (16MHz) 16KCK/14CK+65ms atmega8u2_isp: EFUSE ?= FE# = 2.7V brownout atmega8u2_isp: LOCK ?= 2F# = APP protect mode 1, BL protect mode 2 @@ -48,8 +56,12 @@ atmega8u2_isp: isp atmega16u2atUART: TARGET = atmega16u2 atmega16u2atUART: MCU_TARGET = atmega16u2 atmega16u2atUART: CFLAGS += $(COMMON_OPTIONS) $(UART_CMD) -atmega16u2atUART: AVR_FREQ ?= 16000000L +atmega16u2atUART: AVR_FREQ ?= 16000000L +ifndef BIGBOOT ## standard version is 512 Bytes long; starts earlier atmega16u2atUART: LDSECTIONS = -Wl,--section-start=.text=0x3e00 -Wl,--section-start=.version=0x3ffe +else ## bigboot version is 1024 Bytes long; starts earlier +atmega16u2atUART: LDSECTIONS = -Wl,--section-start=.text=0x3c00 -Wl,--section-start=.version=0x3ffe +endif atmega16u2atUART: $(PROGRAM)_atmega16u2_UART$(UART)_$(BAUD_RATE)_$(AVR_FREQ).hex ifndef PRODUCTION atmega16u2atUART: $(PROGRAM)_atmega16u2_UART$(UART)_$(BAUD_RATE)_$(AVR_FREQ).lst @@ -60,7 +72,11 @@ atmega16u2: atmega16u2_isp: atmega16u2 atmega16u2_isp: TARGET = atmega16u2 atmega16u2_isp: MCU_TARGET = atmega16u2 -atmega16u2_isp: HFUSE ?= DE# = 512 byte boot, JTAG disabled +ifndef BIGBOOT ## standard version is 512 Bytes long; starts earlier +atmega16u2_isp: HFUSE ?= DE# = 512 byte boot, SPI (ISP!!!) enabled, JTAG disabled +else ## bigboot version is 1024 Bytes long; starts earlier +atmega16u2_isp: HFUSE ?= DC# = 1024 byte boot, SPI (ISP!!!) enabled, JTAG disabled +endif atmega16u2_isp: LFUSE ?= FF# = Full Swing xtal (16MHz) 16KCK/14CK+65ms atmega16u2_isp: EFUSE ?= FE# = 2.7V brownout atmega16u2_isp: LOCK ?= 2F# = APP protect mode 1, BL protect mode 2 @@ -74,8 +90,12 @@ atmega16u2_isp: isp atmega32u2atUART: TARGET = atmega32u2 atmega32u2atUART: MCU_TARGET = atmega32u2 atmega32u2atUART: CFLAGS += $(COMMON_OPTIONS) $(UART_CMD) -atmega32u2atUART: AVR_FREQ ?= 16000000L +atmega32u2atUART: AVR_FREQ ?= 16000000L +ifndef BIGBOOT ## standard version is 512 Bytes long; starts earlier atmega32u2atUART: LDSECTIONS = -Wl,--section-start=.text=0x7e00 -Wl,--section-start=.version=0x7ffe +else ## bigboot version is 1024 Bytes long; starts earlier +atmega32u2atUART: LDSECTIONS = -Wl,--section-start=.text=0x7c00 -Wl,--section-start=.version=0x7ffe +endif atmega32u2atUART: $(PROGRAM)_atmega32u2_UART$(UART)_$(BAUD_RATE)_$(AVR_FREQ).hex ifndef PRODUCTION atmega32u2atUART: $(PROGRAM)_atmega32u2_UART$(UART)_$(BAUD_RATE)_$(AVR_FREQ).lst @@ -86,7 +106,11 @@ atmega32u2: atmega32u2_isp: atmega32u2 atmega32u2_isp: TARGET = atmega32u2 atmega32u2_isp: MCU_TARGET = atmega32u2 -atmega32u2_isp: HFUSE ?= DE# = 512 byte boot, JTAG disabled +ifndef BIGBOOT ## standard version is 512 Bytes long; starts earlier +atmega32u2_isp: HFUSE ?= DE# = 512 byte boot, SPI (ISP!!!) enabled, JTAG disabled +else ## bigboot version is 1024 Bytes long; starts earlier +atmega32u2_isp: HFUSE ?= DC# = 1024 byte boot, SPI (ISP!!!) enabled, JTAG disabled +endif atmega32u2_isp: LFUSE ?= FF# = Full Swing xtal (16MHz) 16KCK/14CK+65ms atmega32u2_isp: EFUSE ?= FE# = 2.7V brownout atmega32u2_isp: LOCK ?= 2F# = APP protect mode 1, BL protect mode 2 @@ -100,8 +124,12 @@ atmega32u2_isp: isp atmega16u4atUART: TARGET = atmega16u4 atmega16u4atUART: MCU_TARGET = atmega16u4 atmega16u4atUART: CFLAGS += $(COMMON_OPTIONS) $(UART_CMD) -atmega16u4atUART: AVR_FREQ ?= 16000000L -atmega16u4atUART: LDSECTIONS = -Wl,--section-start=.text=0x7e00 -Wl,--section-start=.version=0x7ffe +atmega16u4atUART: AVR_FREQ ?= 16000000L +ifndef BIGBOOT ## standard version is 512 Bytes long; starts earlier +atmega16u4atUART: LDSECTIONS = -Wl,--section-start=.text=0x3e00 -Wl,--section-start=.version=0x3ffe +else ## bigboot version is 1024 Bytes long; starts earlier +atmega16u4atUART: LDSECTIONS = -Wl,--section-start=.text=0x3c00 -Wl,--section-start=.version=0x3ffe +endif atmega16u4atUART: $(PROGRAM)_atmega16u4_UART$(UART)_$(BAUD_RATE)_$(AVR_FREQ).hex ifndef PRODUCTION atmega16u4atUART: $(PROGRAM)_atmega16u4_UART$(UART)_$(BAUD_RATE)_$(AVR_FREQ).lst @@ -113,7 +141,11 @@ atmega16u4: atmega16u4_isp: atmega16u4 atmega16u4_isp: TARGET = atmega16u4 atmega16u4_isp: MCU_TARGET = atmega16u4 -atmega16u4_isp: HFUSE ?= DE# = 512 byte boot, JTAG disabled +ifndef BIGBOOT ## standard version is 512 Bytes long; starts earlier +atmega16u4_isp: HFUSE ?= DE# = 512 byte boot, SPI (ISP!!!) enabled, JTAG disabled +else ## bigboot version is 1024 Bytes long; starts earlier +atmega16u4_isp: HFUSE ?= DC# = 1024 byte boot, SPI (ISP!!!) enabled, JTAG disabled +endif atmega16u4_isp: LFUSE ?= FF# = Full Swing xtal (16MHz) 16KCK/14CK+65ms atmega16u4_isp: EFUSE ?= FB# = 2.6V brownout atmega16u4_isp: LOCK ?= 2F# = APP protect mode 1, BL protect mode 2 @@ -127,8 +159,12 @@ atmega16u4_isp: isp atmega32u4atUART: TARGET = atmega32u4 atmega32u4atUART: MCU_TARGET = atmega32u4 atmega32u4atUART: CFLAGS += $(COMMON_OPTIONS) $(UART_CMD) -atmega32u4atUART: AVR_FREQ ?= 16000000L +atmega32u4atUART: AVR_FREQ ?= 16000000L +ifndef BIGBOOT ## standard version is 512 Bytes long; starts earlier atmega32u4atUART: LDSECTIONS = -Wl,--section-start=.text=0x7e00 -Wl,--section-start=.version=0x7ffe +else ## bigboot version is 1024 Bytes long; starts earlier +atmega32u4atUART: LDSECTIONS = -Wl,--section-start=.text=0x7c00 -Wl,--section-start=.version=0x7ffe +endif atmega32u4atUART: $(PROGRAM)_atmega32u4_UART$(UART)_$(BAUD_RATE)_$(AVR_FREQ).hex ifndef PRODUCTION atmega32u4atUART: $(PROGRAM)_atmega32u4_UART$(UART)_$(BAUD_RATE)_$(AVR_FREQ).lst @@ -140,7 +176,11 @@ atmega32u4: atmega32u4_isp: atmega32u4 atmega32u4_isp: TARGET = atmega32u4 atmega32u4_isp: MCU_TARGET = atmega32u4 -atmega32u4_isp: HFUSE ?= DE# = 512 byte boot, JTAG disabled +ifndef BIGBOOT ## standard version is 512 Bytes long; starts earlier +atmega32u4_isp: HFUSE ?= DE# = 512 byte boot, SPI (ISP!!!) enabled, JTAG disabled +else ## bigboot version is 1024 Bytes long; starts earlier +atmega32u4_isp: HFUSE ?= DC# = 1024 byte boot, SPI (ISP!!!) enabled, JTAG disabled +endif atmega32u4_isp: LFUSE ?= FF# = Full Swing xtal (16MHz) 16KCK/14CK+65ms atmega32u4_isp: EFUSE ?= FB# = 2.6V brownout atmega32u4_isp: LOCK ?= 2F# = APP protect mode 1, BL protect mode 2 @@ -154,22 +194,174 @@ atmega32u4_isp: isp atmega32u6atUART: TARGET = atmega32u6 atmega32u6atUART: MCU_TARGET = atmega32u6 atmega32u6atUART: CFLAGS += $(COMMON_OPTIONS) $(UART_CMD) -atmega32u6atUART: AVR_FREQ ?= 16000000L +atmega32u6atUART: AVR_FREQ ?= 16000000L +ifndef BIGBOOT ## standard version is 512 Bytes long; starts earlier atmega32u6atUART: LDSECTIONS = -Wl,--section-start=.text=0x7e00 -Wl,--section-start=.version=0x7ffe +else ## bigboot version is 1024 Bytes long; starts earlier +atmega32u6atUART: LDSECTIONS = -Wl,--section-start=.text=0x7c00 -Wl,--section-start=.version=0x7ffe +endif atmega32u6atUART: $(PROGRAM)_atmega32u6_UART$(UART)_$(BAUD_RATE)_$(AVR_FREQ).hex ifndef PRODUCTION atmega32u6atUART: $(PROGRAM)_atmega32u6_UART$(UART)_$(BAUD_RATE)_$(AVR_FREQ).lst endif atmega32u6: -# disable blinking the LED to make the bootloader to fit in 512 Bytes Bootsection "$(MAKE)" atmega32u6atUART UART?=1 atmega32u6_isp: atmega32u6 atmega32u6_isp: TARGET = atmega32u6 -atmega32u6_isp: MCU_TARGET = atmega32u6 -atmega32u6_isp: HFUSE ?= DE# = 512 byte boot, JTAG disabled +atmega32u6_isp: MCU_TARGET = atmega32u6 +ifndef BIGBOOT ## standard version is 512 Bytes long; starts earlier +atmega32u6_isp: HFUSE ?= DE# = 512 byte boot, SPI (ISP!!!) enabled, JTAG disabled +else ## bigboot version is 1024 Bytes long; starts earlier +atmega32u6_isp: HFUSE ?= DC# = 1024 byte boot, SPI (ISP!!!) enabled, JTAG disabled +endif atmega32u6_isp: LFUSE ?= FF# = Full Swing xtal (16MHz) 16KCK/14CK+65ms atmega32u6_isp: EFUSE ?= FB# = 2.6V brownout atmega32u6_isp: LOCK ?= 2F# = APP protect mode 1, BL protect mode 2 atmega32u6_isp: isp + +#----------------------- +# AT90USB646 +#----------------------- +#at90usb646 +at90usb646atUART: TARGET = at90usb646 +at90usb646atUART: MCU_TARGET = at90usb646 +at90usb646atUART: CFLAGS += $(COMMON_OPTIONS) $(UART_CMD) +at90usb646atUART: AVR_FREQ ?= 16000000L +ifndef BIGBOOT ## standard version is 512 Bytes long; starts earlier +at90usb646atUART: LDSECTIONS = -Wl,--section-start=.text=0xfc00 -Wl,--section-start=.version=0xfffe +else ## bigboot version is 1024 Bytes long; starts earlier +at90usb646atUART: LDSECTIONS = -Wl,--section-start=.text=0xf800 -Wl,--section-start=.version=0xfffe +endif +at90usb646atUART: $(PROGRAM)_at90usb646_UART$(UART)_$(BAUD_RATE)_$(AVR_FREQ).hex +ifndef PRODUCTION +at90usb646atUART: $(PROGRAM)_at90usb646_UART$(UART)_$(BAUD_RATE)_$(AVR_FREQ).lst +endif +at90usb646: + "$(MAKE)" at90usb646atUART UART?=1 + +at90usb646_isp: at90usb646 +at90usb646_isp: TARGET = at90usb646 +at90usb646_isp: MCU_TARGET = at90usb646 +ifndef BIGBOOT ## standard version is 1024 Bytes long; starts earlier +at90usb646_isp: HFUSE ?= DE# = 1024 byte boot, SPI (ISP!!!) enabled, JTAG disabled +else ## bigboot version is 2048 Bytes long; starts earlier +at90usb646_isp: HFUSE ?= DC# = 2048 byte boot, SPI (ISP!!!) enabled, JTAG disabled +endif +at90usb646_isp: LFUSE ?= FF# = Full Swing xtal (16MHz) 16KCK/14CK+65ms +at90usb646_isp: EFUSE ?= FB# = 2.6V brownout +at90usb646_isp: LOCK ?= 2F# = APP protect mode 1, BL protect mode 2 +at90usb646_isp: isp + + +#----------------------- +# AT90USB647 +#----------------------- +#at90usb647 +at90usb647atUART: TARGET = at90usb647 +at90usb647atUART: MCU_TARGET = at90usb647 +at90usb647atUART: CFLAGS += $(COMMON_OPTIONS) $(UART_CMD) +at90usb647atUART: AVR_FREQ ?= 16000000L +ifndef BIGBOOT ## standard version is 1024 Bytes long; starts earlier +at90usb647atUART: LDSECTIONS = -Wl,--section-start=.text=0xfc00 -Wl,--section-start=.version=0xfffe +else ## bigboot version is 2048 Bytes long; starts earlier +at90usb647atUART: LDSECTIONS = -Wl,--section-start=.text=0xf800 -Wl,--section-start=.version=0xfffe +endif +at90usb647atUART: $(PROGRAM)_at90usb647_UART$(UART)_$(BAUD_RATE)_$(AVR_FREQ).hex +ifndef PRODUCTION +at90usb647atUART: $(PROGRAM)_at90usb647_UART$(UART)_$(BAUD_RATE)_$(AVR_FREQ).lst +endif +at90usb647: + "$(MAKE)" at90usb647atUART UART?=1 + +at90usb647_isp: at90usb647 +at90usb647_isp: TARGET = at90usb647 +at90usb647_isp: MCU_TARGET = at90usb647 +ifndef BIGBOOT ## standard version is 1024 Bytes long; starts earlier +at90usb647_isp: HFUSE ?= DE# = 1024 byte boot, SPI (ISP!!!) enabled, JTAG disabled +else ## bigboot version is 2048 Bytes long; starts earlier +at90usb647_isp: HFUSE ?= DC# = 2048 byte boot, SPI (ISP!!!) enabled, JTAG disabled +endif +at90usb647_isp: LFUSE ?= FF# = Full Swing xtal (16MHz) 16KCK/14CK+65ms +at90usb647_isp: EFUSE ?= FB# = 2.6V brownout +at90usb647_isp: LOCK ?= 2F# = APP protect mode 1, BL protect mode 2 +at90usb647_isp: isp + + +#----------------------- +# AT90USB1286 +#----------------------- +#at90usb1286 +at90usb1286atUART: TARGET = at90usb1286 +at90usb1286atUART: MCU_TARGET = at90usb1286 +at90usb1286atUART: CFLAGS += $(COMMON_OPTIONS) $(UART_CMD) +at90usb1286atUART: AVR_FREQ ?= 16000000L +ifndef BIGBOOT ## standard version is 1024 Bytes long; starts earlier +at90usb1286atUART: LDSECTIONS = -Wl,--section-start=.text=0x1fc00 -Wl,--section-start=.version=0x1fffe +else ## bigboot version is 2048 Bytes long; starts earlier +at90usb1286atUART: LDSECTIONS = -Wl,--section-start=.text=0x1f800 -Wl,--section-start=.version=0x1fffe +endif +at90usb1286atUART: $(PROGRAM)_at90usb1286_UART$(UART)_$(BAUD_RATE)_$(AVR_FREQ).hex +ifndef PRODUCTION +at90usb1286atUART: $(PROGRAM)_at90usb1286_UART$(UART)_$(BAUD_RATE)_$(AVR_FREQ).lst +endif +at90usb1286: + "$(MAKE)" at90usb1286atUART UART?=1 + +at90usb1286_isp: at90usb1286 +at90usb1286_isp: TARGET = at90usb1286 +at90usb1286_isp: MCU_TARGET = at90usb1286 +ifndef BIGBOOT ## standard version is 1024 Bytes long; starts earlier +at90usb1286_isp: HFUSE ?= DE# = 1024 byte boot, SPI (ISP!!!) enabled, JTAG disabled +else ## bigboot version is 2048 Bytes long; starts earlier +at90usb1286_isp: HFUSE ?= DC# = 2048 byte boot, SPI (ISP!!!) enabled, JTAG disabled +endif +at90usb1286_isp: LFUSE ?= FF# = Full Swing xtal (16MHz) 16KCK/14CK+65ms +at90usb1286_isp: EFUSE ?= FB# = 2.6V brownout +at90usb1286_isp: LOCK ?= 2F# = APP protect mode 1, BL protect mode 2 +at90usb1286_isp: isp + + +#----------------------- +# AT90USB1287 +#----------------------- +#at90usb1287 +at90usb1287atUART: TARGET = at90usb1287 +at90usb1287atUART: MCU_TARGET = at90usb1287 +at90usb1287atUART: CFLAGS += $(COMMON_OPTIONS) $(UART_CMD) +at90usb1287atUART: AVR_FREQ ?= 16000000L +ifndef BIGBOOT ## standard version is 1024 Bytes long; starts earlier +at90usb1287atUART: LDSECTIONS = -Wl,--section-start=.text=0x1fc00 -Wl,--section-start=.version=0x1fffe +else ## bigboot version is 2048 Bytes long; starts earlier +at90usb1287atUART: LDSECTIONS = -Wl,--section-start=.text=0x1f800 -Wl,--section-start=.version=0x1fffe +endif +#at90usb1287atUART: OUTPUT_FILE_ROOT=$(PROGRAM)_$(TARGET)_UART${UART:-"d_d"}_$(BAUD_RATE)_$(AVR_FREQ) +#at90usb1287atUART: $(OUTPUT_FILE_ROOT).hex +test=atm1 +at90usb1287atUART: $(PROGRAM)_${test:-"ddd"}_UART${UART_CMD:-"d_d"}_$(BAUD_RATE)_$(AVR_FREQ).hex + +#at90usb1287atUART: $(PROGRAM)_at90usb1287_UART$(UART)_$(BAUD_RATE)_$(AVR_FREQ).hex +ifndef PRODUCTION +#at90usb1287atUART: $(PROGRAM)_$(TARGET)_UART$(UART)_$(BAUD_RATE)_$(AVR_FREQ).lst + +#at90usb1287atUART: $(OUTPUT_FILE_ROOT).lst +#at90usb1287atUART: $(PROGRAM)_at90usb1287_UART${UART:? "d_d"}_$(BAUD_RATE)_$(AVR_FREQ).lst +at90usb1287atUART: $(PROGRAM)_at90usb1287_${(UART):-"d_d"}_$(BAUD_RATE)_$(AVR_FREQ).lst +endif +at90usb1287: + "$(MAKE)" at90usb1287atUART UART?=1 + +at90usb1287_isp: at90usb1287 +at90usb1287_isp: TARGET = at90usb1287 +at90usb1287_isp: MCU_TARGET = at90usb1287 +ifndef BIGBOOT ## standard version is 1024 Bytes long; starts earlier +at90usb1287_isp: HFUSE ?= DE# = 1024 byte boot, SPI (ISP!!!) enabled, JTAG disabled +else ## bigboot version is 2048 Bytes long; starts earlier +at90usb1287_isp: HFUSE ?= DC# = 2048 byte boot, SPI (ISP!!!) enabled, JTAG disabled +endif +at90usb1287_isp: LFUSE ?= FF# = Full Swing xtal (16MHz) 16KCK/14CK+65ms +at90usb1287_isp: EFUSE ?= FB# = 2.6V brownout +at90usb1287_isp: LOCK ?= 2F# = APP protect mode 1, BL protect mode 2 +at90usb1287_isp: isp + diff --git a/optiboot/bootloaders/optiboot/makeall.usbmcus.sh b/optiboot/bootloaders/optiboot/makeall.usbmcus.sh index 245e77c..1050e35 100644 --- a/optiboot/bootloaders/optiboot/makeall.usbmcus.sh +++ b/optiboot/bootloaders/optiboot/makeall.usbmcus.sh @@ -43,6 +43,10 @@ declare -a mcu_and_params=( "atmega16u4" "LED=C7 LED_START_FLASHES=0 UART=1" # disable blinking the LED to make the bootloader to fit in 512 Bytes Bootsection "atmega32u4" "LED=C7 LED_START_FLASHES=0 UART=1" # disable blinking the LED to make the bootloader to fit in 512 Bytes Bootsection "atmega32u6" "LED=C6 LED_START_FLASHES=2 UART=1" # for some reason it is not necessary to disable blinking the LED for this device +"at90usb646" "LED=C6 LED_START_FLASHES=2 UART=1 BIGBOOT=1" # enable bigboot since at90usbXYZS devices have minimal bootsection of 1048 Bytes +"at90usb647" "LED=C6 LED_START_FLASHES=2 UART=1 BIGBOOT=1" # enable bigboot since at90usbXYZS devices have minimal bootsection of 1048 Bytes +"at90usb1286" "LED=C6 LED_START_FLASHES=2 UART=1 BIGBOOT=1" # enable bigboot since at90usbXYZS devices have minimal bootsection of 1048 Bytes +"at90usb1287" "LED=C6 LED_START_FLASHES=2 UART=1 BIGBOOT=1" # enable bigboot since at90usbXYZS devices have minimal bootsection of 1048 Bytes ) declare -a clock_and_baud=( diff --git a/optiboot/bootloaders/optiboot/makeoptions b/optiboot/bootloaders/optiboot/makeoptions index efd6702..9d92854 100755 --- a/optiboot/bootloaders/optiboot/makeoptions +++ b/optiboot/bootloaders/optiboot/makeoptions @@ -36,3 +36,27 @@ make atmega328 UART=1 #invalid bit rates make atmega328 BAUD_RATE=300 make atmega328 BAUD_RATE=3000000 + +# ===========\ +# usbmcus ==> +# ===========/ + +# atmegaXYu4 +make atmega8u2 LED=D5 BAUD_RATE=115200 # default +make atmega16u2 LED=D5 BAUD_RATE=115200 # default +make atmega32u2 LED=D5 BAUD_RATE=115200 # default + +# atmegaXYu4 +# disable led blinking at startup to save memory +make atmega16u4 LED=C7 LED_START_FLASHES=0 # default +make atmega32u4 LED=C7 LED_START_FLASHES=0 # default +# use a 1048 Byte bootsection to enable the led +make atmega16u4 LED=C7 LED_START_FLASHES=2 BIGBOOT=1 +make atmega32u4 LED=C7 LED_START_FLASHES=2 BIGBOOT=1 +make atmega32u6 LED=C6 LED_START_FLASHES=2 # default + +# at90usbXYZ6/7 +make at90usb646 LED=C6 LED_START_FLASHES=2 BIGBOOT=1 # default +make at90usb647 LED=C6 LED_START_FLASHES=2 BIGBOOT=1 # default +make at90usb1286 LED=C6 LED_START_FLASHES=2 BIGBOOT=1 # default +make at90usb1287 LED=C6 LED_START_FLASHES=2 BIGBOOT=1 # default diff --git a/optiboot/bootloaders/optiboot/pin_defs.h b/optiboot/bootloaders/optiboot/pin_defs.h index f423faf..f3414c1 100644 --- a/optiboot/bootloaders/optiboot/pin_defs.h +++ b/optiboot/bootloaders/optiboot/pin_defs.h @@ -483,7 +483,9 @@ /*------------------------------------------------------------------------ */ #if defined(__AVR_ATmega8U2__) || defined(__AVR_ATmega16U2__) || defined(__AVR_ATmega32U2__) \ -|| (__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega32U6__) +|| defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega32U6__) \ +|| defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB647__) \ +|| defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1287__) /*------------------------------------------------------------------------ */ /* Fix different register names */ #define MPCM0 MPCM1 @@ -549,6 +551,16 @@ #endif #endif // AtmegaXYu6 +/*------------------------------------------------------------------------ */ +#if defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB647__) \ +|| defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1287__) +/*------------------------------------------------------------------------ */ + +#if !defined(LED) +#define LED C6 // because of PWM (OSC3A) +#endif +#endif // At90usbXYz6/7 + #endif // usbmcus