Align some ChibiOS build logic (#8461)
* Align some ChibiOS build logic * infer more makefile logic * Move bootloader logic to chibios file
This commit is contained in:
parent
eef0cb2f90
commit
d8f3c28a37
4 changed files with 39 additions and 52 deletions
|
@ -244,34 +244,6 @@ else
|
||||||
FIRMWARE_FORMAT?=hex
|
FIRMWARE_FORMAT?=hex
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(PLATFORM),CHIBIOS)
|
|
||||||
include $(TMK_PATH)/chibios.mk
|
|
||||||
OPT_OS = chibios
|
|
||||||
ifneq ("$(wildcard $(KEYBOARD_PATH_5)/bootloader_defs.h)","")
|
|
||||||
OPT_DEFS += -include $(KEYBOARD_PATH_5)/bootloader_defs.h
|
|
||||||
else ifneq ("$(wildcard $(KEYBOARD_PATH_5)/boards/$(BOARD)/bootloader_defs.h)","")
|
|
||||||
OPT_DEFS += -include $(KEYBOARD_PATH_5)/boards/$(BOARD)/bootloader_defs.h
|
|
||||||
else ifneq ("$(wildcard $(KEYBOARD_PATH_4)/bootloader_defs.h)","")
|
|
||||||
OPT_DEFS += -include $(KEYBOARD_PATH_4)/bootloader_defs.h
|
|
||||||
else ifneq ("$(wildcard $(KEYBOARD_PATH_4)/boards/$(BOARD)/bootloader_defs.h)","")
|
|
||||||
OPT_DEFS += -include $(KEYBOARD_PATH_4)/boards/$(BOARD)/bootloader_defs.h
|
|
||||||
else ifneq ("$(wildcard $(KEYBOARD_PATH_3)/bootloader_defs.h)","")
|
|
||||||
OPT_DEFS += -include $(KEYBOARD_PATH_3)/bootloader_defs.h
|
|
||||||
else ifneq ("$(wildcard $(KEYBOARD_PATH_3)/boards/$(BOARD)/bootloader_defs.h)","")
|
|
||||||
OPT_DEFS += -include $(KEYBOARD_PATH_3)/boards/$(BOARD)/bootloader_defs.h
|
|
||||||
else ifneq ("$(wildcard $(KEYBOARD_PATH_2)/bootloader_defs.h)","")
|
|
||||||
OPT_DEFS += -include $(KEYBOARD_PATH_2)/bootloader_defs.h
|
|
||||||
else ifneq ("$(wildcard $(KEYBOARD_PATH_2)/boards/$(BOARD)/bootloader_defs.h)","")
|
|
||||||
OPT_DEFS += -include $(KEYBOARD_PATH_2)/boards/$(BOARD)/bootloader_defs.h
|
|
||||||
else ifneq ("$(wildcard $(KEYBOARD_PATH_1)/bootloader_defs.h)","")
|
|
||||||
OPT_DEFS += -include $(KEYBOARD_PATH_1)/bootloader_defs.h
|
|
||||||
else ifneq ("$(wildcard $(KEYBOARD_PATH_1)/boards/$(BOARD)/bootloader_defs.h)","")
|
|
||||||
OPT_DEFS += -include $(KEYBOARD_PATH_1)/boards/$(BOARD)/bootloader_defs.h
|
|
||||||
else ifneq ("$(wildcard $(TOP_DIR)/drivers/boards/$(BOARD)/bootloader_defs.h)","")
|
|
||||||
OPT_DEFS += -include $(TOP_DIR)/drivers/boards/$(BOARD)/bootloader_defs.h
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Find all of the config.h files and add them to our CONFIG_H define.
|
# Find all of the config.h files and add them to our CONFIG_H define.
|
||||||
CONFIG_H :=
|
CONFIG_H :=
|
||||||
ifneq ("$(wildcard $(KEYBOARD_PATH_5)/config.h)","")
|
ifneq ("$(wildcard $(KEYBOARD_PATH_5)/config.h)","")
|
||||||
|
@ -307,11 +279,6 @@ ifneq ("$(wildcard $(KEYBOARD_PATH_5)/post_config.h)","")
|
||||||
POST_CONFIG_H += $(KEYBOARD_PATH_5)/post_config.h
|
POST_CONFIG_H += $(KEYBOARD_PATH_5)/post_config.h
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Save the defines and includes here, so we don't include any keymap specific ones
|
|
||||||
PROJECT_DEFS := $(OPT_DEFS)
|
|
||||||
PROJECT_INC := $(VPATH) $(EXTRAINCDIRS) $(KEYBOARD_PATHS)
|
|
||||||
PROJECT_CONFIG := $(CONFIG_H)
|
|
||||||
|
|
||||||
# Userspace setup and definitions
|
# Userspace setup and definitions
|
||||||
ifeq ("$(USER_NAME)","")
|
ifeq ("$(USER_NAME)","")
|
||||||
USER_NAME := $(KEYMAP)
|
USER_NAME := $(KEYMAP)
|
||||||
|
@ -357,23 +324,17 @@ SRC += $(TMK_COMMON_SRC)
|
||||||
OPT_DEFS += $(TMK_COMMON_DEFS)
|
OPT_DEFS += $(TMK_COMMON_DEFS)
|
||||||
EXTRALDFLAGS += $(TMK_COMMON_LDFLAGS)
|
EXTRALDFLAGS += $(TMK_COMMON_LDFLAGS)
|
||||||
|
|
||||||
ifeq ($(PLATFORM),AVR)
|
include $(TMK_PATH)/$(PLATFORM_KEY).mk
|
||||||
ifeq ($(strip $(PROTOCOL)), VUSB)
|
ifneq ($(strip $(PROTOCOL)),)
|
||||||
include $(TMK_PATH)/protocol/vusb.mk
|
include $(TMK_PATH)/protocol/$(strip $(shell echo $(PROTOCOL) | tr '[:upper:]' '[:lower:]')).mk
|
||||||
else
|
else
|
||||||
include $(TMK_PATH)/protocol/lufa.mk
|
include $(TMK_PATH)/protocol/$(PLATFORM_KEY).mk
|
||||||
endif
|
|
||||||
include $(TMK_PATH)/avr.mk
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(PLATFORM),ARM_ATSAM)
|
# TODO: remove this bodge?
|
||||||
include $(TMK_PATH)/arm_atsam.mk
|
PROJECT_DEFS := $(OPT_DEFS)
|
||||||
include $(TMK_PATH)/protocol/arm_atsam.mk
|
PROJECT_INC := $(VPATH) $(EXTRAINCDIRS) $(KEYBOARD_PATHS)
|
||||||
endif
|
PROJECT_CONFIG := $(CONFIG_H)
|
||||||
|
|
||||||
ifeq ($(PLATFORM),CHIBIOS)
|
|
||||||
include $(TMK_PATH)/protocol/chibios.mk
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(strip $(VISUALIZER_ENABLE)), yes)
|
ifeq ($(strip $(VISUALIZER_ENABLE)), yes)
|
||||||
VISUALIZER_DIR = $(QUANTUM_DIR)/visualizer
|
VISUALIZER_DIR = $(QUANTUM_DIR)/visualizer
|
||||||
|
|
|
@ -213,6 +213,8 @@ ifneq ($(findstring STM32F103, $(MCU)),)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq (,$(filter $(MCU),atmega16u2 atmega32u2 atmega16u4 atmega32u4 at90usb646 at90usb1286))
|
ifneq (,$(filter $(MCU),atmega16u2 atmega32u2 atmega16u4 atmega32u4 at90usb646 at90usb1286))
|
||||||
|
PROTOCOL = LUFA
|
||||||
|
|
||||||
# Processor frequency.
|
# Processor frequency.
|
||||||
# This will define a symbol, F_CPU, in all source code files equal to the
|
# This will define a symbol, F_CPU, in all source code files equal to the
|
||||||
# processor frequency in Hz. You can then use this symbol in your source code to
|
# processor frequency in Hz. You can then use this symbol in your source code to
|
||||||
|
|
|
@ -24,6 +24,7 @@ endif
|
||||||
#
|
#
|
||||||
|
|
||||||
# Imported source files and paths
|
# Imported source files and paths
|
||||||
|
OPT_OS = chibios
|
||||||
CHIBIOS = $(TOP_DIR)/lib/chibios
|
CHIBIOS = $(TOP_DIR)/lib/chibios
|
||||||
CHIBIOS_CONTRIB = $(TOP_DIR)/lib/chibios-contrib
|
CHIBIOS_CONTRIB = $(TOP_DIR)/lib/chibios-contrib
|
||||||
# Startup files. Try a few different locations, for compability with old versions and
|
# Startup files. Try a few different locations, for compability with old versions and
|
||||||
|
@ -49,6 +50,34 @@ PLATFORM_MK = $(CHIBIOS_CONTRIB)/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)/$(PLAT
|
||||||
endif
|
endif
|
||||||
include $(PLATFORM_MK)
|
include $(PLATFORM_MK)
|
||||||
|
|
||||||
|
# Bootloader address
|
||||||
|
ifdef STM32_BOOTLOADER_ADDRESS
|
||||||
|
OPT_DEFS += -DSTM32_BOOTLOADER_ADDRESS=$(STM32_BOOTLOADER_ADDRESS)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq ("$(wildcard $(KEYBOARD_PATH_5)/bootloader_defs.h)","")
|
||||||
|
OPT_DEFS += -include $(KEYBOARD_PATH_5)/bootloader_defs.h
|
||||||
|
else ifneq ("$(wildcard $(KEYBOARD_PATH_5)/boards/$(BOARD)/bootloader_defs.h)","")
|
||||||
|
OPT_DEFS += -include $(KEYBOARD_PATH_5)/boards/$(BOARD)/bootloader_defs.h
|
||||||
|
else ifneq ("$(wildcard $(KEYBOARD_PATH_4)/bootloader_defs.h)","")
|
||||||
|
OPT_DEFS += -include $(KEYBOARD_PATH_4)/bootloader_defs.h
|
||||||
|
else ifneq ("$(wildcard $(KEYBOARD_PATH_4)/boards/$(BOARD)/bootloader_defs.h)","")
|
||||||
|
OPT_DEFS += -include $(KEYBOARD_PATH_4)/boards/$(BOARD)/bootloader_defs.h
|
||||||
|
else ifneq ("$(wildcard $(KEYBOARD_PATH_3)/bootloader_defs.h)","")
|
||||||
|
OPT_DEFS += -include $(KEYBOARD_PATH_3)/bootloader_defs.h
|
||||||
|
else ifneq ("$(wildcard $(KEYBOARD_PATH_3)/boards/$(BOARD)/bootloader_defs.h)","")
|
||||||
|
OPT_DEFS += -include $(KEYBOARD_PATH_3)/boards/$(BOARD)/bootloader_defs.h
|
||||||
|
else ifneq ("$(wildcard $(KEYBOARD_PATH_2)/bootloader_defs.h)","")
|
||||||
|
OPT_DEFS += -include $(KEYBOARD_PATH_2)/bootloader_defs.h
|
||||||
|
else ifneq ("$(wildcard $(KEYBOARD_PATH_2)/boards/$(BOARD)/bootloader_defs.h)","")
|
||||||
|
OPT_DEFS += -include $(KEYBOARD_PATH_2)/boards/$(BOARD)/bootloader_defs.h
|
||||||
|
else ifneq ("$(wildcard $(KEYBOARD_PATH_1)/bootloader_defs.h)","")
|
||||||
|
OPT_DEFS += -include $(KEYBOARD_PATH_1)/bootloader_defs.h
|
||||||
|
else ifneq ("$(wildcard $(KEYBOARD_PATH_1)/boards/$(BOARD)/bootloader_defs.h)","")
|
||||||
|
OPT_DEFS += -include $(KEYBOARD_PATH_1)/boards/$(BOARD)/bootloader_defs.h
|
||||||
|
else ifneq ("$(wildcard $(TOP_DIR)/drivers/boards/$(BOARD)/bootloader_defs.h)","")
|
||||||
|
OPT_DEFS += -include $(TOP_DIR)/drivers/boards/$(BOARD)/bootloader_defs.h
|
||||||
|
endif
|
||||||
|
|
||||||
BOARD_MK :=
|
BOARD_MK :=
|
||||||
|
|
||||||
|
|
|
@ -166,11 +166,6 @@ ifeq ($(strip $(LINK_TIME_OPTIMIZATION_ENABLE)), yes)
|
||||||
TMK_COMMON_DEFS += -DNO_ACTION_FUNCTION
|
TMK_COMMON_DEFS += -DNO_ACTION_FUNCTION
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Bootloader address
|
|
||||||
ifdef STM32_BOOTLOADER_ADDRESS
|
|
||||||
TMK_COMMON_DEFS += -DSTM32_BOOTLOADER_ADDRESS=$(STM32_BOOTLOADER_ADDRESS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Search Path
|
# Search Path
|
||||||
VPATH += $(TMK_PATH)/$(COMMON_DIR)
|
VPATH += $(TMK_PATH)/$(COMMON_DIR)
|
||||||
VPATH += $(TMK_PATH)/$(PLATFORM_COMMON_DIR)
|
VPATH += $(TMK_PATH)/$(PLATFORM_COMMON_DIR)
|
||||||
|
|
Loading…
Reference in a new issue