source: avrstuff/kbd/pcw2hid/bootloader/makefile@ 3fde1f7

main
Last change on this file since 3fde1f7 was 3fde1f7, checked in by PulkoMandy <pulkomandy@…>, 5 months ago

pcw2hid: Fixup programming instructions

Use a very slow SCK clock for loading up the fuses
Use a somewhat slow clock for loading up the bootloader

This allows to get both of them loaded reliably.

  • Property mode set to 100644
File size: 2.5 KB
Line 
1#
2# LUFA Library
3# Copyright (C) Dean Camera, 2021.
4#
5# dean [at] fourwalledcubicle [dot] com
6# www.lufa-lib.org
7#
8# --------------------------------------
9# LUFA Project Makefile.
10# --------------------------------------
11
12# Run "make help" for target help.
13
14MCU = at90usb162
15ARCH = AVR8
16BOARD = USBKEY
17F_CPU = 8000000
18F_USB = $(F_CPU)
19OPTIMIZATION = s
20TARGET = BootloaderDFU
21SRC = $(TARGET).c Descriptors.c BootloaderAPI.c BootloaderAPITable.S $(LUFA_SRC_USB)
22LUFA_PATH = ../code/lufa-LUFA-210130/LUFA
23CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DBOOT_START_ADDR=$(BOOT_START_OFFSET)
24LD_FLAGS = -Wl,--section-start=.text=$(BOOT_START_OFFSET) $(BOOT_API_LD_FLAGS)
25LTO = Y
26
27AVRDUDE_PROGRAMMER=stk500 -B20
28AVRDUDE_PORT=/dev/ports/usb0
29
30# Flash size and bootloader section sizes of the target, in KB. These must
31# match the target's total FLASH size and the bootloader size set in the
32# device's fuses.
33FLASH_SIZE_KB = 16
34BOOT_SECTION_SIZE_KB = 4
35
36# Bootloader address calculation formulas
37# Do not modify these macros, but rather modify the dependent values above.
38CALC_ADDRESS_IN_HEX = $(shell printf "0x%X" $$(( $(1) )) )
39BOOT_START_OFFSET = $(call CALC_ADDRESS_IN_HEX, ($(FLASH_SIZE_KB) - $(BOOT_SECTION_SIZE_KB)) * 1024 )
40BOOT_SEC_OFFSET = $(call CALC_ADDRESS_IN_HEX, ($(FLASH_SIZE_KB) * 1024) - ($(strip $(1))) )
41
42# Bootloader linker section flags for relocating the API table sections to
43# known FLASH addresses - these should not normally be user-edited.
44BOOT_SECTION_LD_FLAG = -Wl,--section-start=$(strip $(1))=$(call BOOT_SEC_OFFSET, $(3)) -Wl,--undefined=$(strip $(2))
45BOOT_API_LD_FLAGS = $(call BOOT_SECTION_LD_FLAG, .apitable_trampolines, BootloaderAPI_Trampolines, 96)
46BOOT_API_LD_FLAGS += $(call BOOT_SECTION_LD_FLAG, .apitable_jumptable, BootloaderAPI_JumpTable, 32)
47BOOT_API_LD_FLAGS += $(call BOOT_SECTION_LD_FLAG, .apitable_signatures, BootloaderAPI_Signatures, 8)
48
49# Default target
50all:
51
52# Include LUFA-specific DMBS extension modules
53DMBS_LUFA_PATH ?= $(LUFA_PATH)/Build/LUFA
54include $(DMBS_LUFA_PATH)/lufa-sources.mk
55include $(DMBS_LUFA_PATH)/lufa-gcc.mk
56
57# Include common DMBS build system modules
58DMBS_PATH ?= $(LUFA_PATH)/Build/DMBS/DMBS
59include $(DMBS_PATH)/core.mk
60include $(DMBS_PATH)/cppcheck.mk
61include $(DMBS_PATH)/doxygen.mk
62include $(DMBS_PATH)/dfu.mk
63include $(DMBS_PATH)/gcc.mk
64include $(DMBS_PATH)/hid.mk
65include $(DMBS_PATH)/avrdude.mk
66include $(DMBS_PATH)/atprogram.mk
Note: See TracBrowser for help on using the repository browser.