Add APIs to the incomplete Mass Storage bootloader.
[pub/lufa.git] / Bootloaders / Incomplete / MassStorage / makefile
index 566c47d..fca29ed 100644 (file)
@@ -20,14 +20,14 @@ OPTIMIZATION = s
 TARGET       = MassStorage\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
@@ -35,6 +35,13 @@ CALC_ADDRESS_IN_HEX   = $(shell printf "0x%X" $$(( $(1) )) )
 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