MCU = at90usb1287\r
ARCH = AVR8\r
BOARD = USBKEY\r
-F_CPU = 8000000\r
+F_CPU = 16000000\r
F_USB = $(F_CPU)\r
OPTIMIZATION = s\r
-TARGET = MassStorage\r
+TARGET = BootloaderMassStorage\r
SRC = $(TARGET).c Descriptors.c Lib/SCSI.c Lib/VirtualFAT.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS)\r
LUFA_PATH = ../../../LUFA\r
-CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/\r
-LD_FLAGS = -Wl,--section-start=.text=$(BOOT_START_OFFSET)\r
+CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DBOOT_START_ADDR=$(BOOT_START_OFFSET)\r
+LD_FLAGS = -Wl,--section-start=.text=$(BOOT_START_OFFSET) $(BOOT_API_LD_FLAGS)\r
\r
# Flash size and bootloader section sizes of the target, in KB. These must\r
# match the target's total FLASH size and the bootloader size set in the\r
# device's fuses.\r
-FLASH_SIZE_KB := 128\r
-BOOT_SECTION_SIZE_KB := 8\r
+FLASH_SIZE_KB = 128\r
+BOOT_SECTION_SIZE_KB = 8\r
\r
# Bootloader address calculation formulas\r
# Do not modify these macros, but rather modify the dependent values above.\r
BOOT_START_OFFSET = $(call CALC_ADDRESS_IN_HEX, ($(FLASH_SIZE_KB) - $(BOOT_SECTION_SIZE_KB)) * 1024 )\r
BOOT_SEC_OFFSET = $(call CALC_ADDRESS_IN_HEX, ($(FLASH_SIZE_KB) * 1024) - $(strip $(1)) )\r
\r
+# Bootloader linker section flags for relocating the API table sections to\r
+# known FLASH addresses - these should not normally be user-edited.\r
+BOOT_SECTION_LD_FLAG = -Wl,--section-start=.apitable_$(strip $(1))=$(call BOOT_SEC_OFFSET, $(3)) -Wl,--undefined=BootloaderAPI_$(strip $(2))\r
+BOOT_API_LD_FLAGS = $(call BOOT_SECTION_LD_FLAG, trampolines, Trampolines, 96)\r
+BOOT_API_LD_FLAGS += $(call BOOT_SECTION_LD_FLAG, jumptable, JumpTable, 32)\r
+BOOT_API_LD_FLAGS += $(call BOOT_SECTION_LD_FLAG, signatures, Signatures, 8)\r
+\r
# Default target\r
all:\r
\r