Merge remote-tracking branch 'origin/develop' into xap

This commit is contained in:
QMK Bot 2023-01-19 00:27:37 +00:00
commit be9c13dcf9
9 changed files with 28 additions and 19 deletions

View File

@ -184,6 +184,12 @@ include $(BUILDDEFS_PATH)/converters.mk
include $(BUILDDEFS_PATH)/mcu_selection.mk include $(BUILDDEFS_PATH)/mcu_selection.mk
# PLATFORM_KEY should be detected in info.json via key 'processor' (or rules.mk 'MCU')
ifeq ($(PLATFORM_KEY),)
$(call CATASTROPHIC_ERROR,Platform not defined)
endif
PLATFORM=$(shell echo $(PLATFORM_KEY) | tr '[:lower:]' '[:upper:]')
# Find all the C source files to be compiled in subfolders. # Find all the C source files to be compiled in subfolders.
KEYBOARD_SRC := KEYBOARD_SRC :=
@ -257,24 +263,6 @@ ifneq ("$(wildcard $(KEYBOARD_PATH_5)/$(KEYBOARD_FOLDER_5).h)","")
FOUND_KEYBOARD_H = $(KEYBOARD_FOLDER_5).h FOUND_KEYBOARD_H = $(KEYBOARD_FOLDER_5).h
endif endif
# Determine and set parameters based on the keyboard's processor family.
# We can assume a ChibiOS target When MCU_FAMILY is defined since it's
# not used for LUFA
ifdef MCU_FAMILY
PLATFORM=CHIBIOS
PLATFORM_KEY=chibios
FIRMWARE_FORMAT?=bin
OPT_DEFS += -DMCU_$(MCU_FAMILY)
else ifdef ARM_ATSAM
PLATFORM=ARM_ATSAM
PLATFORM_KEY=arm_atsam
FIRMWARE_FORMAT=bin
else
PLATFORM=AVR
PLATFORM_KEY=avr
FIRMWARE_FORMAT?=hex
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)","")

View File

@ -19,6 +19,7 @@ ifneq ($(CONVERT_TO),)
-include $(CONVERTER)/pre_converter.mk -include $(CONVERTER)/pre_converter.mk
PLATFORM_KEY = $(shell echo $(CONVERTER) | rev | cut -d "/" -f4 | rev)
TARGET := $(TARGET)_$(CONVERT_TO) TARGET := $(TARGET)_$(CONVERT_TO)
# Configure any defaults # Configure any defaults

View File

@ -38,6 +38,8 @@
"PS2_MOUSE_ENABLE": {"info_key": "ps2.mouse_enabled", "value_type": "bool"}, "PS2_MOUSE_ENABLE": {"info_key": "ps2.mouse_enabled", "value_type": "bool"},
"PS2_DRIVER": {"info_key": "ps2.driver"}, "PS2_DRIVER": {"info_key": "ps2.driver"},
"PLATFORM_KEY": {"info_key": "platform_key", "to_json": false},
// Items we want flagged in lint // Items we want flagged in lint
"CTPC": {"info_key": "_deprecated.ctpc", "deprecated": true, "replace_with": "CONVERT_TO=proton_c"}, "CTPC": {"info_key": "_deprecated.ctpc", "deprecated": true, "replace_with": "CONVERT_TO=proton_c"},
"CONVERT_TO_PROTON_C": {"info_key": "_deprecated.ctpc", "deprecated": true, "replace_with": "CONVERT_TO=proton_c"}, "CONVERT_TO_PROTON_C": {"info_key": "_deprecated.ctpc", "deprecated": true, "replace_with": "CONVERT_TO=proton_c"},

View File

@ -257,6 +257,9 @@
"c_macro": { "c_macro": {
"type": "boolean" "type": "boolean"
}, },
"json_layout": {
"type": "boolean"
},
"layout": { "layout": {
"type": "array", "type": "array",
"items": { "items": {

View File

@ -52,7 +52,7 @@ def _validate(keyboard, info_data):
community_layouts_names = list(map(lambda layout: f'LAYOUT_{layout}', community_layouts)) community_layouts_names = list(map(lambda layout: f'LAYOUT_{layout}', community_layouts))
# Make sure we have at least one layout # Make sure we have at least one layout
if len(layouts) == 0: if len(layouts) == 0 or all(not layout.get('json_layout', False) for layout in layouts.values()):
_log_error(info_data, 'No LAYOUTs defined! Need at least one layout defined in info.json.') _log_error(info_data, 'No LAYOUTs defined! Need at least one layout defined in info.json.')
# Providing only LAYOUT_all "because I define my layouts in a 3rd party tool" # Providing only LAYOUT_all "because I define my layouts in a 3rd party tool"
@ -107,6 +107,7 @@ def info_json(keyboard):
for layout_name, layout_json in layouts.items(): for layout_name, layout_json in layouts.items():
if not layout_name.startswith('LAYOUT_kc'): if not layout_name.startswith('LAYOUT_kc'):
layout_json['c_macro'] = True layout_json['c_macro'] = True
layout_json['json_layout'] = False
info_data['layouts'][layout_name] = layout_json info_data['layouts'][layout_name] = layout_json
# Merge in the data from info.json, config.h, and rules.mk # Merge in the data from info.json, config.h, and rules.mk
@ -751,6 +752,7 @@ def arm_processor_rules(info_data, rules):
""" """
info_data['processor_type'] = 'arm' info_data['processor_type'] = 'arm'
info_data['protocol'] = 'ChibiOS' info_data['protocol'] = 'ChibiOS'
info_data['platform_key'] = 'chibios'
if 'STM32' in info_data['processor']: if 'STM32' in info_data['processor']:
info_data['platform'] = 'STM32' info_data['platform'] = 'STM32'
@ -758,6 +760,7 @@ def arm_processor_rules(info_data, rules):
info_data['platform'] = rules['MCU_SERIES'] info_data['platform'] = rules['MCU_SERIES']
elif 'ARM_ATSAM' in rules: elif 'ARM_ATSAM' in rules:
info_data['platform'] = 'ARM_ATSAM' info_data['platform'] = 'ARM_ATSAM'
info_data['platform_key'] = 'arm_atsam'
return info_data return info_data
@ -767,6 +770,7 @@ def avr_processor_rules(info_data, rules):
""" """
info_data['processor_type'] = 'avr' info_data['processor_type'] = 'avr'
info_data['platform'] = rules['ARCH'] if 'ARCH' in rules else 'unknown' info_data['platform'] = rules['ARCH'] if 'ARCH' in rules else 'unknown'
info_data['platform_key'] = 'avr'
info_data['protocol'] = 'V-USB' if info_data['processor'] in VUSB_PROCESSORS else 'LUFA' info_data['protocol'] = 'V-USB' if info_data['processor'] in VUSB_PROCESSORS else 'LUFA'
# FIXME(fauxpark/anyone): Eventually we should detect the protocol by looking at PROTOCOL inherited from mcu_selection.mk: # FIXME(fauxpark/anyone): Eventually we should detect the protocol by looking at PROTOCOL inherited from mcu_selection.mk:
@ -821,6 +825,7 @@ def merge_info_jsons(keyboard, info_data):
msg = 'Number of keys for %s does not match! info.json specifies %d keys, C macro specifies %d' msg = 'Number of keys for %s does not match! info.json specifies %d keys, C macro specifies %d'
_log_error(info_data, msg % (layout_name, len(layout['layout']), len(info_data['layouts'][layout_name]['layout']))) _log_error(info_data, msg % (layout_name, len(layout['layout']), len(info_data['layouts'][layout_name]['layout'])))
else: else:
info_data['layouts'][layout_name]['json_layout'] = True
for new_key, existing_key in zip(layout['layout'], info_data['layouts'][layout_name]['layout']): for new_key, existing_key in zip(layout['layout'], info_data['layouts'][layout_name]['layout']):
existing_key.update(new_key) existing_key.update(new_key)
else: else:
@ -828,6 +833,7 @@ def merge_info_jsons(keyboard, info_data):
_log_error(info_data, f'Layout "{layout_name}" has no "matrix" definition in either "info.json" or "<keyboard>.h"!') _log_error(info_data, f'Layout "{layout_name}" has no "matrix" definition in either "info.json" or "<keyboard>.h"!')
else: else:
layout['c_macro'] = False layout['c_macro'] = False
layout['json_layout'] = True
info_data['layouts'][layout_name] = layout info_data['layouts'][layout_name] = layout
# Update info_data with the new data # Update info_data with the new data

View File

@ -27,6 +27,8 @@
# the respective file under `platforms/<PLATFORM>/bootloaders/custom.c` to see # the respective file under `platforms/<PLATFORM>/bootloaders/custom.c` to see
# which functions may be overridden. # which functions may be overridden.
FIRMWARE_FORMAT?=bin
ifeq ($(strip $(BOOTLOADER)), custom) ifeq ($(strip $(BOOTLOADER)), custom)
OPT_DEFS += -DBOOTLOADER_CUSTOM OPT_DEFS += -DBOOTLOADER_CUSTOM
BOOTLOADER_TYPE = custom BOOTLOADER_TYPE = custom

View File

@ -37,6 +37,8 @@
# BOOTLOADER_SIZE can still be defined manually, but it's recommended # BOOTLOADER_SIZE can still be defined manually, but it's recommended
# you add any possible configuration to this list # you add any possible configuration to this list
FIRMWARE_FORMAT?=hex
ifeq ($(strip $(BOOTLOADER)), custom) ifeq ($(strip $(BOOTLOADER)), custom)
OPT_DEFS += -DBOOTLOADER_CUSTOM OPT_DEFS += -DBOOTLOADER_CUSTOM
BOOTLOADER_TYPE = custom BOOTLOADER_TYPE = custom

View File

@ -36,6 +36,8 @@
# the respective file under `platforms/<PLATFORM>/bootloaders/custom.c` to see # the respective file under `platforms/<PLATFORM>/bootloaders/custom.c` to see
# which functions may be overridden. # which functions may be overridden.
FIRMWARE_FORMAT?=bin
ifeq ($(strip $(BOOTLOADER)), custom) ifeq ($(strip $(BOOTLOADER)), custom)
OPT_DEFS += -DBOOTLOADER_CUSTOM OPT_DEFS += -DBOOTLOADER_CUSTOM
BOOTLOADER_TYPE = custom BOOTLOADER_TYPE = custom

View File

@ -442,6 +442,9 @@ LDFLAGS += $(SHARED_LDFLAGS) $(SHARED_LDSYMBOLS) $(TOOLCHAIN_LDFLAGS) $(TOOLCHA
# Tell QMK that we are hosting it on ChibiOS. # Tell QMK that we are hosting it on ChibiOS.
OPT_DEFS += -DPROTOCOL_CHIBIOS OPT_DEFS += -DPROTOCOL_CHIBIOS
# And what flavor of MCU
OPT_DEFS += -DMCU_$(MCU_FAMILY)
# ChibiOS supports synchronization primitives like a Mutex # ChibiOS supports synchronization primitives like a Mutex
OPT_DEFS += -DPLATFORM_SUPPORTS_SYNCHRONIZATION OPT_DEFS += -DPLATFORM_SUPPORTS_SYNCHRONIZATION