3 #     Copyright (C) Dean Camera, 2012.
 
   5 #  dean [at] fourwalledcubicle [dot] com
 
   8 # --------------------------------------
 
   9 #         LUFA Project Makefile.
 
  10 # --------------------------------------
 
  12 # Starting byte address of the bootloader, as a byte address - computed via the formula
 
  13 #   BOOT_START = ((FLASH_SIZE_KB - BOOT_SECTION_SIZE_KB) * 1024)
 
  15 # Note that the bootloader size and start address given in AVRStudio is in words and not
 
  16 # bytes, and so will need to be doubled to obtain the byte address needed by AVR-GCC.
 
  18 BOOT_SECTION_SIZE_KB := 8
 
  20 # Formulas used to calculate the starting address of the Bootloader section, and the User Application
 
  21 # API jump table (for more information on the latter, see the bootloader documentation). These formulas
 
  22 # should not need to be altered - modify the FLASH_SIZE_KB and BOOT_SECTION_KB values above instead.
 
  23 BOOT_START           := 0x$(shell echo "obase=16; ($(FLASH_SIZE_KB) - $(BOOT_SECTION_SIZE_KB)) * 1024" | bc)
 
  24 BOOT_API_TABLESTART  := 0x$(shell echo "obase=16; (($(FLASH_SIZE_KB) * 1024) - 96)" | bc)
 
  32 TARGET       = BootloaderHID
 
  33 SRC          = $(TARGET).c Descriptors.c $(LUFA_SRC_USB)
 
  34 LUFA_PATH    = ../../LUFA/
 
  35 CC_FLAGS     = -DUSE_LUFA_CONFIG_HEADER -IConfig/
 
  36 LD_FLAGS     = -Wl,--section-start=.text=$(BOOT_START)
 
  41 # Include LUFA build script makefiles
 
  42 include $(LUFA_PATH)/Build/lufa.core.in
 
  43 include $(LUFA_PATH)/Build/lufa.sources.in
 
  44 include $(LUFA_PATH)/Build/lufa.build.in
 
  45 include $(LUFA_PATH)/Build/lufa.doxygen.in
 
  46 include $(LUFA_PATH)/Build/lufa.avrdude.in