diff --git a/avr/bootloaders/HoodLoader2/Board/Board.h b/avr/bootloaders/HoodLoader2/Board/Board.h index 8c4a8c5..fe23a66 100644 --- a/avr/bootloaders/HoodLoader2/Board/Board.h +++ b/avr/bootloaders/HoodLoader2/Board/Board.h @@ -57,6 +57,7 @@ extern "C" { #define ARDUINO_MICRO_PID 0x0037 // Bootloader, not program! #define ARDUINO_DUE_PID 0x003D + #ifndef USB_DESCRIPTOR_STRING // If the Makefile did not supply a product string... // USB product string settings #if (PRODUCTID == ARDUINO_UNO_PID) #define USB_DESCRIPTOR_STRING L"HoodLoader2 Uno" @@ -73,6 +74,7 @@ extern "C" { #else #define USB_DESCRIPTOR_STRING L"HoodLoader2 Lufa" #endif + #endif // Arduino Due 16u2 #if (PRODUCTID == ARDUINO_DUE_PID) diff --git a/avr/bootloaders/HoodLoader2/build.sh b/avr/bootloaders/HoodLoader2/build.sh new file mode 100644 index 0000000..ff67a5f --- /dev/null +++ b/avr/bootloaders/HoodLoader2/build.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +cat vidpid.txt | while read mcu vid pid name; do + make clean + make VID=$vid PID=$pid MCU=$mcu NAME="$name" "$@" all + # Please tell me where to find thebuild products... + #mv build-product.ihex hoodloader_$mcu_$vid_$pid.ihex +done diff --git a/avr/bootloaders/HoodLoader2/makefile b/avr/bootloaders/HoodLoader2/makefile index 4529dfb..904db64 100644 --- a/avr/bootloaders/HoodLoader2/makefile +++ b/avr/bootloaders/HoodLoader2/makefile @@ -11,7 +11,9 @@ # Run "make help" for target help. +ifeq ($(MCU),) MCU = atmega16u2 +endif ARCH = AVR8 BOARD = USER F_CPU = 16000000 @@ -23,6 +25,15 @@ LUFA_PATH = ../lufa-LUFA-140928/LUFA CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ $(HOODLOADER2_OPTS) -DBOOT_START_ADDR=$(BOOT_START_OFFSET) $(REGS) -flto -fuse-linker-plugin LD_FLAGS = -Wl,--section-start=.text=$(BOOT_START_OFFSET) $(BOOT_API_LD_FLAGS),--section-start=.data=$(RAM_OFFSET) $(REGS) -flto -fuse-linker-plugin +ifneq ($(MCU),atmega8u2) +ifneq ($(MCU),atmega16u2) +ifneq ($(MCU),atmega16u4) +ifneq ($(MCU),atmega32u4) +$(error MCU must be one of atmega8u2, atmega16u2, atmega16u4 or atmega32u4) +endif +endif +endif +endif # Flash size and bootloader section sizes of the target, in KB. These must # match the target's total FLASH size and the bootloader size set in the @@ -41,8 +52,20 @@ BOOT_SECTION_SIZE_KB = 4 #define ARDUINO_MICRO_PID 0x0037 // Bootloader, not program! #define ARDUINO_DUE_PID 0x003D -HOODLOADER2_OPTS = -DVENDORID=ARDUINO_VID -HOODLOADER2_OPTS += -DPRODUCTID=ARDUINO_UNO_PID +ifeq ($(VID),) +VID := ARDUINO_VID +endif + +ifeq ($(PID),) +PID := ARDUINO_UNO_PID +endif + +HOODLOADER2_OPTS = -DVENDORID=$(VID) +HOODLOADER2_OPTS += -DPRODUCTID=$(PID) + +ifneq ($(NAME),) +HOODLOADER2_OPTS += "-DUSB_DESCRIPTOR_STRING=\"$(NAME)\"" +endif # 1200 is the baud to load the Bootloader from an Arduino sketch, # 57600 turns out to be the actual baud rate for uploading for default arduino bootloaders (and arduino nano by default!) diff --git a/avr/bootloaders/HoodLoader2/vidpid.txt b/avr/bootloaders/HoodLoader2/vidpid.txt new file mode 100644 index 0000000..5de3a1c --- /dev/null +++ b/avr/bootloaders/HoodLoader2/vidpid.txt @@ -0,0 +1,6 @@ +atmega16u2 0x2341 0x0043 HoodLoader2 Uno +atmega16u2 0x2341 0x0042 HoodLoader2 Mega +atmega16u2 0x2341 0x0044 HoodLoader2 ADK +atmega32u4 0x2341 0x0036 HoodLoader2 Leo +atmeag32u4 0x2341 0x0037 HoodLoader2 Micro +atmega32u4 0x2341 0x003c HoodLoader2 Esplora