]> git.donarmstrong.com Git - qmk_firmware.git/blob - lib/lufa/Bootloaders/MassStorage/makefile
more crlf issues
[qmk_firmware.git] / lib / lufa / Bootloaders / MassStorage / makefile
1 #\r
2 #             LUFA Library\r
3 #     Copyright (C) Dean Camera, 2017.\r
4 #\r
5 #  dean [at] fourwalledcubicle [dot] com\r
6 #           www.lufa-lib.org\r
7 #\r
8 # --------------------------------------\r
9 #         LUFA Project Makefile.\r
10 # --------------------------------------\r
11 \r
12 # Run "make help" for target help.\r
13 \r
14 MCU          = at90usb1287\r
15 ARCH         = AVR8\r
16 BOARD        = USBKEY\r
17 F_CPU        = 8000000\r
18 F_USB        = $(F_CPU)\r
19 OPTIMIZATION = s\r
20 TARGET       = BootloaderMassStorage\r
21 SRC          = $(TARGET).c Descriptors.c BootloaderAPI.c BootloaderAPITable.S Lib/SCSI.c Lib/VirtualFAT.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS)\r
22 LUFA_PATH    = ../../LUFA\r
23 CC_FLAGS     = -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DBOOT_START_ADDR=$(BOOT_START_OFFSET)\r
24 LD_FLAGS     = -Wl,--section-start=.text=$(BOOT_START_OFFSET) $(BOOT_API_LD_FLAGS)\r
25 \r
26 # Flash size and bootloader section sizes of the target, in KB. These must\r
27 # match the target's total FLASH size and the bootloader size set in the\r
28 # device's fuses.\r
29 FLASH_SIZE_KB         = 128\r
30 BOOT_SECTION_SIZE_KB  = 8\r
31 \r
32 # Bootloader address calculation formulas\r
33 # Do not modify these macros, but rather modify the dependent values above.\r
34 CALC_ADDRESS_IN_HEX   = $(shell printf "0x%X" $$(( $(1) )) )\r
35 BOOT_START_OFFSET     = $(call CALC_ADDRESS_IN_HEX, ($(FLASH_SIZE_KB) - $(BOOT_SECTION_SIZE_KB)) * 1024 )\r
36 BOOT_SEC_OFFSET       = $(call CALC_ADDRESS_IN_HEX, ($(FLASH_SIZE_KB) * 1024) - ($(strip $(1))) )\r
37 \r
38 # Bootloader linker section flags for relocating the API table sections to\r
39 # known FLASH addresses - these should not normally be user-edited.\r
40 BOOT_SECTION_LD_FLAG  = -Wl,--section-start=$(strip $(1))=$(call BOOT_SEC_OFFSET, $(3)) -Wl,--undefined=$(strip $(2))\r
41 BOOT_API_LD_FLAGS     = $(call BOOT_SECTION_LD_FLAG, .apitable_trampolines, BootloaderAPI_Trampolines, 96)\r
42 BOOT_API_LD_FLAGS    += $(call BOOT_SECTION_LD_FLAG, .apitable_jumptable,   BootloaderAPI_JumpTable,   32)\r
43 BOOT_API_LD_FLAGS    += $(call BOOT_SECTION_LD_FLAG, .apitable_signatures,  BootloaderAPI_Signatures,  8)\r
44 \r
45 # Check if the bootloader needs an AUX section, located before the real bootloader section to store some of the\r
46 # bootloader code. This is required for 32KB and smaller devices, where the actual bootloader is 6KB but the maximum\r
47 # bootloader section size is 4KB. The actual usable application space will be reduced by 6KB for these devices.\r
48 ifeq ($(BOOT_SECTION_SIZE_KB),8)\r
49   CC_FLAGS           += -DAUX_BOOT_SECTION_SIZE=0\r
50 else\r
51   AUX_BOOT_SECTION_SIZE_KB = (6 - $(BOOT_SECTION_SIZE_KB))\r
52 \r
53   CC_FLAGS           += -DAUX_BOOT_SECTION_SIZE='($(AUX_BOOT_SECTION_SIZE_KB) * 1024)'\r
54   LD_FLAGS           += -Wl,--section-start=.boot_aux=$(call BOOT_SEC_OFFSET, (($(BOOT_SECTION_SIZE_KB) + $(AUX_BOOT_SECTION_SIZE_KB)) * 1024 - 16))\r
55   LD_FLAGS           += $(call BOOT_SECTION_LD_FLAG, .boot_aux_trampoline, Boot_AUX_Trampoline, ($(BOOT_SECTION_SIZE_KB) + $(AUX_BOOT_SECTION_SIZE_KB)) * 1024)\r
56 endif\r
57 \r
58 # Default target\r
59 all:\r
60 \r
61 # Include LUFA-specific DMBS extension modules\r
62 DMBS_LUFA_PATH ?= $(LUFA_PATH)/Build/LUFA\r
63 include $(DMBS_LUFA_PATH)/lufa-sources.mk\r
64 include $(DMBS_LUFA_PATH)/lufa-gcc.mk\r
65 \r
66 # Include common DMBS build system modules\r
67 DMBS_PATH      ?= $(LUFA_PATH)/Build/DMBS/DMBS\r
68 include $(DMBS_PATH)/core.mk\r
69 include $(DMBS_PATH)/cppcheck.mk\r
70 include $(DMBS_PATH)/doxygen.mk\r
71 include $(DMBS_PATH)/dfu.mk\r
72 include $(DMBS_PATH)/gcc.mk\r
73 include $(DMBS_PATH)/hid.mk\r
74 include $(DMBS_PATH)/avrdude.mk\r
75 include $(DMBS_PATH)/atprogram.mk\r