diff options
author | Joel Challis <git@zvecr.com> | 2021-11-19 18:41:02 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-19 10:41:02 -0800 |
commit | 2728603fe6d73e805a539d337fd01051c46ca806 (patch) | |
tree | 5c83ffc7efa112da870bd5d8502a9d91d4792f35 /tmk_core | |
parent | 43b9e23bae12916d5161f03700c9bfe46737324b (diff) |
Move tmk_core/common/<plat> (#13918)
Diffstat (limited to 'tmk_core')
81 files changed, 1 insertions, 7404 deletions
diff --git a/tmk_core/arm_atsam.mk b/tmk_core/arm_atsam.mk deleted file mode 100644 index b49bf764d7..0000000000 --- a/tmk_core/arm_atsam.mk +++ /dev/null @@ -1,67 +0,0 @@ -# Hey Emacs, this is a -*- makefile -*- -############################################################################## -# Compiler settings -# -CC = $(CC_PREFIX) arm-none-eabi-gcc -OBJCOPY = arm-none-eabi-objcopy -OBJDUMP = arm-none-eabi-objdump -SIZE = arm-none-eabi-size -AR = arm-none-eabi-ar -NM = arm-none-eabi-nm -HEX = $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock -R .signature -EEP = $(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) -BIN = - -COMMON_VPATH += $(LIB_PATH)/arm_atsam/packs/atmel/SAMD51_DFP/1.0.70/include -COMMON_VPATH += $(LIB_PATH)/arm_atsam/packs/arm/cmsis/5.0.1/CMSIS/Include - -COMPILEFLAGS += -funsigned-char -COMPILEFLAGS += -funsigned-bitfields -COMPILEFLAGS += -ffunction-sections -COMPILEFLAGS += -fshort-enums -COMPILEFLAGS += -fno-inline-small-functions -COMPILEFLAGS += -fno-strict-aliasing -COMPILEFLAGS += -mfloat-abi=hard -COMPILEFLAGS += -mfpu=fpv4-sp-d16 -COMPILEFLAGS += -mthumb - -#ALLOW_WARNINGS = yes - -CFLAGS += $(COMPILEFLAGS) - -CXXFLAGS += $(COMPILEFLAGS) -CXXFLAGS += -fno-exceptions -std=c++11 - -LDFLAGS +=-Wl,--gc-sections -LDFLAGS += -Wl,-Map="%OUT%%PROJ_NAME%.map" -LDFLAGS += -Wl,--start-group -LDFLAGS += -Wl,--end-group -LDFLAGS += --specs=rdimon.specs -LDFLAGS += -T$(LIB_PATH)/arm_atsam/packs/atmel/SAMD51_DFP/1.0.70/gcc/gcc/samd51j18a_flash.ld - -OPT_DEFS += -DPROTOCOL_ARM_ATSAM - -MCUFLAGS = -mcpu=$(MCU) -MCUFLAGS += -D__$(ARM_ATSAM)__ - -# List any extra directories to look for libraries here. -# Each directory must be seperated by a space. -# Use forward slashes for directory separators. -# For a directory that has spaces, enclose it in quotes. -EXTRALIBDIRS = - -cpfirmware: warn-arm_atsam -.INTERMEDIATE: warn-arm_atsam -warn-arm_atsam: $(FIRMWARE_FORMAT) - $(info @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@) - $(info This MCU support package has a lack of support from the upstream provider (Massdrop).) - $(info There are currently questions about valid licensing, and at this stage it's likely) - $(info their boards and supporting code will be removed from QMK in the near future. Please) - $(info contact Massdrop for support, and encourage them to align their future board design) - $(info choices to gain proper license compatibility with QMK.) - $(info @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@) - -# Convert hex to bin. -bin: $(BUILD_DIR)/$(TARGET).hex - $(OBJCOPY) -Iihex -Obinary $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin - $(COPY) $(BUILD_DIR)/$(TARGET).bin $(TARGET).bin; diff --git a/tmk_core/avr.mk b/tmk_core/avr.mk deleted file mode 100644 index c52262273e..0000000000 --- a/tmk_core/avr.mk +++ /dev/null @@ -1,179 +0,0 @@ -# Hey Emacs, this is a -*- makefile -*- -############################################################################## -# Compiler settings -# -CC = $(CC_PREFIX) avr-gcc -OBJCOPY = avr-objcopy -OBJDUMP = avr-objdump -SIZE = avr-size -AR = avr-ar -NM = avr-nm -HEX = $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock -R .signature -EEP = $(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) -BIN = - -COMPILEFLAGS += -funsigned-char -COMPILEFLAGS += -funsigned-bitfields -COMPILEFLAGS += -ffunction-sections -COMPILEFLAGS += -fdata-sections -COMPILEFLAGS += -fpack-struct -COMPILEFLAGS += -fshort-enums - -ASFLAGS += $(AVR_ASFLAGS) - -CFLAGS += $(COMPILEFLAGS) $(AVR_CFLAGS) -CFLAGS += -fno-inline-small-functions -CFLAGS += -fno-strict-aliasing - -CXXFLAGS += $(COMPILEFLAGS) -CXXFLAGS += -fno-exceptions -std=c++11 - -LDFLAGS +=-Wl,--gc-sections - -OPT_DEFS += -DF_CPU=$(F_CPU)UL - -MCUFLAGS = -mmcu=$(MCU) - -# List any extra directories to look for libraries here. -# Each directory must be seperated by a space. -# Use forward slashes for directory separators. -# For a directory that has spaces, enclose it in quotes. -EXTRALIBDIRS = - - -#---------------- External Memory Options ---------------- - -# 64 KB of external RAM, starting after internal RAM (ATmega128!), -# used for variables (.data/.bss) and heap (malloc()). -#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff - -# 64 KB of external RAM, starting after internal RAM (ATmega128!), -# only used for heap (malloc()). -#EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff - -EXTMEMOPTS = - -#---------------- Debugging Options ---------------- - -# Debugging format. -# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs. -# AVR Studio 4.10 requires dwarf-2. -# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run. -DEBUG = dwarf-2 - -# For simulavr only - target MCU frequency. -DEBUG_MFREQ = $(F_CPU) - -# Set the DEBUG_UI to either gdb or insight. -# DEBUG_UI = gdb -DEBUG_UI = insight - -# Set the debugging back-end to either avarice, simulavr. -DEBUG_BACKEND = avarice -#DEBUG_BACKEND = simulavr - -# GDB Init Filename. -GDBINIT_FILE = __avr_gdbinit - -# When using avarice settings for the JTAG -JTAG_DEV = /dev/com1 - -# Debugging port used to communicate between GDB / avarice / simulavr. -DEBUG_PORT = 4242 - -# Debugging host used to communicate between GDB / avarice / simulavr, normally -# just set to localhost unless doing some sort of crazy debugging when -# avarice is running on a different computer. -DEBUG_HOST = localhost - -#============================================================================ - -# Convert hex to bin. -bin: $(BUILD_DIR)/$(TARGET).hex -ifeq ($(BOOTLOADER),lufa-ms) - $(eval BIN_PADDING=$(shell n=`expr 32768 - $(BOOTLOADER_SIZE)` && echo $$(($$n)) || echo 0)) - $(OBJCOPY) -Iihex -Obinary $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin --pad-to $(BIN_PADDING) -else - $(OBJCOPY) -Iihex -Obinary $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin -endif - $(COPY) $(BUILD_DIR)/$(TARGET).bin $(TARGET).bin; - -# copy bin to FLASH.bin -flashbin: bin - $(COPY) $(BUILD_DIR)/$(TARGET).bin FLASH.bin; - -# Generate avr-gdb config/init file which does the following: -# define the reset signal, load the target file, connect to target, and set -# a breakpoint at main(). -gdb-config: - @$(REMOVE) $(GDBINIT_FILE) - @echo define reset >> $(GDBINIT_FILE) - @echo SIGNAL SIGHUP >> $(GDBINIT_FILE) - @echo end >> $(GDBINIT_FILE) - @echo file $(BUILD_DIR)/$(TARGET).elf >> $(GDBINIT_FILE) - @echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE) -ifeq ($(DEBUG_BACKEND),simulavr) - @echo load >> $(GDBINIT_FILE) -endif - @echo break main >> $(GDBINIT_FILE) - -debug: gdb-config $(BUILD_DIR)/$(TARGET).elf -ifeq ($(DEBUG_BACKEND), avarice) - @echo Starting AVaRICE - Press enter when "waiting to connect" message displays. - @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \ - $(BUILD_DIR)/$(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT) - @$(WINSHELL) /c pause - -else - @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \ - $(DEBUG_MFREQ) --port $(DEBUG_PORT) -endif - @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE) - - - - -# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB. -COFFCONVERT = $(OBJCOPY) --debugging -COFFCONVERT += --change-section-address .data-0x800000 -COFFCONVERT += --change-section-address .bss-0x800000 -COFFCONVERT += --change-section-address .noinit-0x800000 -COFFCONVERT += --change-section-address .eeprom-0x810000 - - - -coff: $(BUILD_DIR)/$(TARGET).elf - @$(SECHO) $(MSG_COFF) $(BUILD_DIR)/$(TARGET).cof - $(COFFCONVERT) -O coff-avr $< $(BUILD_DIR)/$(TARGET).cof - - -extcoff: $(BUILD_DIR)/$(TARGET).elf - @$(SECHO) $(MSG_EXTENDED_COFF) $(BUILD_DIR)/$(TARGET).cof - $(COFFCONVERT) -O coff-ext-avr $< $(BUILD_DIR)/$(TARGET).cof - -ifeq ($(strip $(BOOTLOADER)), qmk-dfu) -QMK_BOOTLOADER_TYPE = DFU -else ifeq ($(strip $(BOOTLOADER)), qmk-hid) -QMK_BOOTLOADER_TYPE = HID -endif - -bootloader: -ifeq ($(strip $(QMK_BOOTLOADER_TYPE)),) - $(error Please set BOOTLOADER to "qmk-dfu" or "qmk-hid" first!) -else - make -C lib/lufa/Bootloaders/$(QMK_BOOTLOADER_TYPE)/ clean - $(QMK_BIN) generate-dfu-header --quiet --keyboard $(KEYBOARD) --output lib/lufa/Bootloaders/$(QMK_BOOTLOADER_TYPE)/Keyboard.h - $(eval MAX_SIZE=$(shell n=`$(CC) -E -mmcu=$(MCU) -D__ASSEMBLER__ $(CFLAGS) $(OPT_DEFS) tmk_core/common/avr/bootloader_size.c 2> /dev/null | sed -ne 's/\r//;/^#/n;/^AVR_SIZE:/,$${s/^AVR_SIZE: //;p;}'` && echo $$(($$n)) || echo 0)) - $(eval PROGRAM_SIZE_KB=$(shell n=`expr $(MAX_SIZE) / 1024` && echo $$(($$n)) || echo 0)) - $(eval BOOT_SECTION_SIZE_KB=$(shell n=`expr $(BOOTLOADER_SIZE) / 1024` && echo $$(($$n)) || echo 0)) - $(eval FLASH_SIZE_KB=$(shell n=`expr $(PROGRAM_SIZE_KB) + $(BOOT_SECTION_SIZE_KB)` && echo $$(($$n)) || echo 0)) - make -C lib/lufa/Bootloaders/$(QMK_BOOTLOADER_TYPE)/ MCU=$(MCU) ARCH=$(ARCH) F_CPU=$(F_CPU) FLASH_SIZE_KB=$(FLASH_SIZE_KB) BOOT_SECTION_SIZE_KB=$(BOOT_SECTION_SIZE_KB) - printf "Bootloader$(QMK_BOOTLOADER_TYPE).hex copied to $(TARGET)_bootloader.hex\n" - cp lib/lufa/Bootloaders/$(QMK_BOOTLOADER_TYPE)/Bootloader$(QMK_BOOTLOADER_TYPE).hex $(TARGET)_bootloader.hex -endif - -production: $(BUILD_DIR)/$(TARGET).hex bootloader cpfirmware - @cat $(BUILD_DIR)/$(TARGET).hex | awk '/^:00000001FF/ == 0' > $(TARGET)_production.hex - @cat $(TARGET)_bootloader.hex >> $(TARGET)_production.hex - echo "File sizes:" - $(SIZE) $(TARGET).hex $(TARGET)_bootloader.hex $(TARGET)_production.hex diff --git a/tmk_core/chibios.mk b/tmk_core/chibios.mk deleted file mode 100644 index 6b298732c2..0000000000 --- a/tmk_core/chibios.mk +++ /dev/null @@ -1,436 +0,0 @@ -# Hey Emacs, this is a -*- makefile -*- -############################################################################## -# Architecture or project specific options -# - -# Stack size to be allocated to the Cortex-M process stack. This stack is -# the stack used by the main() thread. -ifeq ($(USE_PROCESS_STACKSIZE),) - USE_PROCESS_STACKSIZE = 0x800 -endif - -# Stack size to the allocated to the Cortex-M main/exceptions stack. This -# stack is used for processing interrupts and exceptions. -ifeq ($(USE_EXCEPTIONS_STACKSIZE),) - USE_EXCEPTIONS_STACKSIZE = 0x400 -endif - -# -# Architecture or project specific options -############################################################################## - -############################################################################## -# Project, sources and paths -# - -# Imported source files and paths -OPT_OS = chibios -CHIBIOS = $(TOP_DIR)/lib/chibios -CHIBIOS_CONTRIB = $(TOP_DIR)/lib/chibios-contrib - -# -# Startup, Port and Platform support selection -############################################################################## - -ifeq ($(strip $(MCU)), risc-v) - # RISC-V Support - # As of 7.4.2021 there is only one supported RISC-V platform in Chibios-Contrib, - # therefore all required settings are hard-coded - STARTUP_MK = $(CHIBIOS_CONTRIB)/os/common/startup/RISCV-ECLIC/compilers/GCC/mk/startup_$(MCU_STARTUP).mk - PORT_V = $(CHIBIOS_CONTRIB)/os/common/ports/RISCV-ECLIC/compilers/GCC/mk/port.mk - RULESPATH = $(CHIBIOS_CONTRIB)/os/common/startup/RISCV-ECLIC/compilers/GCC - PLATFORM_MK = $(CHIBIOS_CONTRIB)/os/hal/ports/GD/GD32VF103/platform.mk -else - # ARM Support - CHIBIOS_PORT ?= - ifeq ("$(CHIBIOS_PORT)","") - CHIBIOS_PORT = ARMv$(ARMV)-M - endif - - # Startup files. Try a few different locations, for compability with old versions and - # for things hardware in the contrib repository - STARTUP_MK = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_$(MCU_STARTUP).mk - ifeq ("$(wildcard $(STARTUP_MK))","") - STARTUP_MK = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_$(MCU_STARTUP).mk - ifeq ("$(wildcard $(STARTUP_MK))","") - STARTUP_MK = $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_$(MCU_STARTUP).mk - endif - endif - - # Port files. Try a few different locations, for compability with old versions and - # for things hardware in the contrib repository - PORT_V = $(CHIBIOS)/os/common/ports/$(CHIBIOS_PORT)/compilers/GCC/mk/port.mk - ifeq ("$(wildcard $(PORT_V))","") - PORT_V = $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v$(ARMV)m.mk - ifeq ("$(wildcard $(PORT_V))","") - PORT_V = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v$(ARMV)m.mk - endif - endif - - # Rules location. Try a few different locations, for compability with old versions and - # for things hardware in the contrib repository - RULESPATH = $(CHIBIOS)/os/common/ports/$(CHIBIOS_PORT)/compilers/GCC - ifeq ("$(wildcard $(RULESPATH)/rules.mk)","") - RULESPATH = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC - ifeq ("$(wildcard $(RULESPATH)/rules.mk)","") - RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC - endif - endif -endif - -ifeq ("$(PLATFORM_NAME)","") - PLATFORM_NAME = platform -endif - -ifeq ("$(wildcard $(PLATFORM_MK))","") - PLATFORM_MK = $(CHIBIOS)/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)/$(PLATFORM_NAME).mk - ifeq ("$(wildcard $(PLATFORM_MK))","") - PLATFORM_MK = $(CHIBIOS_CONTRIB)/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)/$(PLATFORM_NAME).mk - endif -endif - -include $(STARTUP_MK) -include $(PORT_V) -include $(PLATFORM_MK) - -# -# Board support selection. -############################################################################## - -BOARD_MK := - -ifneq ("$(wildcard $(KEYBOARD_PATH_5)/boards/$(BOARD)/board.mk)","") - BOARD_PATH = $(KEYBOARD_PATH_5) - BOARD_MK += $(KEYBOARD_PATH_5)/boards/$(BOARD)/board.mk -else ifneq ("$(wildcard $(KEYBOARD_PATH_4)/boards/$(BOARD)/board.mk)","") - BOARD_PATH = $(KEYBOARD_PATH_4) - BOARD_MK += $(KEYBOARD_PATH_4)/boards/$(BOARD)/board.mk -else ifneq ("$(wildcard $(KEYBOARD_PATH_3)/boards/$(BOARD)/board.mk)","") - BOARD_PATH = $(KEYBOARD_PATH_3) - BOARD_MK += $(KEYBOARD_PATH_3)/boards/$(BOARD)/board.mk -else ifneq ("$(wildcard $(KEYBOARD_PATH_2)/boards/$(BOARD)/board.mk)","") - BOARD_PATH = $(KEYBOARD_PATH_2) - BOARD_MK += $(KEYBOARD_PATH_2)/boards/$(BOARD)/board.mk -else ifneq ("$(wildcard $(KEYBOARD_PATH_1)/boards/$(BOARD)/board.mk)","") - BOARD_PATH = $(KEYBOARD_PATH_1) - BOARD_MK += $(KEYBOARD_PATH_1)/boards/$(BOARD)/board.mk -else ifneq ("$(wildcard $(TOP_DIR)/platforms/chibios/boards/$(BOARD)/board/board.mk)","") - BOARD_PATH = $(TOP_DIR)/platforms/chibios/boards/$(BOARD) - BOARD_MK += $(TOP_DIR)/platforms/chibios/boards/$(BOARD)/board/board.mk - KEYBOARD_PATHS += $(BOARD_PATH)/configs - ifneq ("$(wildcard $(BOARD_PATH)/rules.mk)","") - include $(BOARD_PATH)/rules.mk - endif -endif - -ifeq ("$(wildcard $(BOARD_MK))","") - BOARD_MK = $(CHIBIOS)/os/hal/boards/$(BOARD)/board.mk - ifeq ("$(wildcard $(BOARD_MK))","") - BOARD_MK = $(CHIBIOS_CONTRIB)/os/hal/boards/$(BOARD)/board.mk - endif -endif - -include $(BOARD_MK) - -# -# Bootloader selection. -############################################################################## - -# Set bootloader address if supplied. -ifdef STM32_BOOTLOADER_ADDRESS - OPT_DEFS += -DSTM32_BOOTLOADER_ADDRESS=$(STM32_BOOTLOADER_ADDRESS) -endif - -# Work out if we need to set up the include for the bootloader definitions -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)/boot |