From eaa9106ec74591593e638ac015a5c90d17b30612 Mon Sep 17 00:00:00 2001 From: Zach White Date: Sat, 9 Jan 2021 20:18:47 -0800 Subject: [PATCH] Add support for specifying BOARD in info.json (#11492) * add support for specifying BOARD in info.json * move BOARD from rules.mk to info.json for clueboard * fix keyboards that do not require board * remove out of compliance values --- data/schemas/keyboard.jsonschema | 5 +++++ keyboards/clueboard/60/info.json | 1 + keyboards/clueboard/60/rules.mk | 2 -- keyboards/clueboard/66/rev4/info.json | 1 + keyboards/clueboard/66/rev4/rules.mk | 1 - keyboards/clueboard/66_hotswap/gen1/info.json | 1 + keyboards/clueboard/66_hotswap/gen1/rules.mk | 1 - keyboards/clueboard/california/info.json | 1 + keyboards/clueboard/california/rules.mk | 1 - keyboards/cmm_studio/saka68/info.json | 2 -- lib/python/qmk/cli/generate/rules_mk.py | 4 +++- lib/python/qmk/info.py | 8 +++++++- 12 files changed, 19 insertions(+), 9 deletions(-) diff --git a/data/schemas/keyboard.jsonschema b/data/schemas/keyboard.jsonschema index f76c7fd189..0b3d6f393d 100644 --- a/data/schemas/keyboard.jsonschema +++ b/data/schemas/keyboard.jsonschema @@ -27,6 +27,11 @@ "type": "string", "enum": ["MK20DX128", "MK20DX256", "MKL26Z64", "STM32F042", "STM32F072", "STM32F103", "STM32F303", "STM32F401", "STM32F411", "at90usb1286", "at90usb646", "atmega16u2", "atmega328p", "atmega32a", "atmega32u2", "atmega32u4", "attiny85", "cortex-m4", "unknown"] }, + "board": { + "type": "string", + "minLength": 2, + "pattern": "^[a-zA-Z_][0-9a-zA-Z_]*$" + }, "bootloader": { "type": "string", "enum": ["atmel-dfu", "bootloadHID", "caterina", "halfkay", "kiibohd", "lufa-dfu", "lufa-ms", "micronucleus", "qmk-dfu", "stm32-dfu", "stm32duino", "unknown", "USBasp"] diff --git a/keyboards/clueboard/60/info.json b/keyboards/clueboard/60/info.json index 2da993437c..a68081daf0 100644 --- a/keyboards/clueboard/60/info.json +++ b/keyboards/clueboard/60/info.json @@ -6,6 +6,7 @@ "width": 15, "debounce": 6, "processor": "STM32F303", + "board": "QMK_PROTON_C", "diode_direction": "COL2ROW", "features": { "audio": true, diff --git a/keyboards/clueboard/60/rules.mk b/keyboards/clueboard/60/rules.mk index 6bc7eb7619..c73b4c4731 100644 --- a/keyboards/clueboard/60/rules.mk +++ b/keyboards/clueboard/60/rules.mk @@ -1,4 +1,2 @@ -BOARD = QMK_PROTON_C - # project specific files SRC = led.c diff --git a/keyboards/clueboard/66/rev4/info.json b/keyboards/clueboard/66/rev4/info.json index aef1dee7aa..9c8fcbef5e 100644 --- a/keyboards/clueboard/66/rev4/info.json +++ b/keyboards/clueboard/66/rev4/info.json @@ -6,6 +6,7 @@ "width": 16.5, "debounce": 5, "processor": "STM32F303", + "board": "QMK_PROTON_C", "diode_direction": "COL2ROW", "features": { "audio": true, diff --git a/keyboards/clueboard/66/rev4/rules.mk b/keyboards/clueboard/66/rev4/rules.mk index 14a7fa7b71..6e7633bfe0 100644 --- a/keyboards/clueboard/66/rev4/rules.mk +++ b/keyboards/clueboard/66/rev4/rules.mk @@ -1,2 +1 @@ -BOARD = QMK_PROTON_C # This file intentionally left blank diff --git a/keyboards/clueboard/66_hotswap/gen1/info.json b/keyboards/clueboard/66_hotswap/gen1/info.json index 18afe54126..bcf66e8afc 100644 --- a/keyboards/clueboard/66_hotswap/gen1/info.json +++ b/keyboards/clueboard/66_hotswap/gen1/info.json @@ -6,6 +6,7 @@ "width": 16.5, "debounce": 5, "processor": "STM32F303", + "board": "QMK_PROTON_C", "diode_direction": "COL2ROW", "features": { "audio": true, diff --git a/keyboards/clueboard/66_hotswap/gen1/rules.mk b/keyboards/clueboard/66_hotswap/gen1/rules.mk index e23f9a4b3c..33cf11a793 100644 --- a/keyboards/clueboard/66_hotswap/gen1/rules.mk +++ b/keyboards/clueboard/66_hotswap/gen1/rules.mk @@ -1,4 +1,3 @@ -BOARD = QMK_PROTON_C LED_MATRIX_DRIVER = IS31FL3731 # project specific files diff --git a/keyboards/clueboard/california/info.json b/keyboards/clueboard/california/info.json index 02c06ce513..e40b2338cd 100644 --- a/keyboards/clueboard/california/info.json +++ b/keyboards/clueboard/california/info.json @@ -3,6 +3,7 @@ "url": "", "maintainer": "skullydazed", "processor": "STM32F303", + "board": "QMK_PROTON_C", "matrix_pins": { "direct": [ ["A10", "A9"], diff --git a/keyboards/clueboard/california/rules.mk b/keyboards/clueboard/california/rules.mk index 14a7fa7b71..6e7633bfe0 100644 --- a/keyboards/clueboard/california/rules.mk +++ b/keyboards/clueboard/california/rules.mk @@ -1,2 +1 @@ -BOARD = QMK_PROTON_C # This file intentionally left blank diff --git a/keyboards/cmm_studio/saka68/info.json b/keyboards/cmm_studio/saka68/info.json index 75a78649bc..ac6d0465ae 100644 --- a/keyboards/cmm_studio/saka68/info.json +++ b/keyboards/cmm_studio/saka68/info.json @@ -1,6 +1,4 @@ { - "keyboard_name": "", - "url": "", "maintainer": "qmk", "width": 17.25, "height": 5, diff --git a/lib/python/qmk/cli/generate/rules_mk.py b/lib/python/qmk/cli/generate/rules_mk.py index 0fdccb4048..b262e3c666 100755 --- a/lib/python/qmk/cli/generate/rules_mk.py +++ b/lib/python/qmk/cli/generate/rules_mk.py @@ -7,6 +7,7 @@ from qmk.info import info_json from qmk.path import is_keyboard, normpath info_to_rules = { + 'board': 'BOARD', 'bootloader': 'BOOTLOADER', 'processor': 'MCU', } @@ -37,7 +38,8 @@ def generate_rules_mk(cli): # Bring in settings for info_key, rule_key in info_to_rules.items(): - rules_mk_lines.append(f'{rule_key} ?= {kb_info_json[info_key]}') + if info_key in kb_info_json: + rules_mk_lines.append(f'{rule_key} ?= {kb_info_json[info_key]}') # Find features that should be enabled if 'features' in kb_info_json: diff --git a/lib/python/qmk/info.py b/lib/python/qmk/info.py index 0ea5136a97..cc81f7a086 100644 --- a/lib/python/qmk/info.py +++ b/lib/python/qmk/info.py @@ -462,7 +462,7 @@ def _extract_rules_mk(info_data): """Pull some keyboard information from existing rules.mk files """ rules = rules_mk(info_data['keyboard_folder']) - mcu = rules.get('MCU') + mcu = rules.get('MCU', info_data.get('processor')) if mcu in CHIBIOS_PROCESSORS: arm_processor_rules(info_data, rules) @@ -594,6 +594,12 @@ def arm_processor_rules(info_data, rules): elif 'ARM_ATSAM' in rules: info_data['platform'] = 'ARM_ATSAM' + if 'BOARD' in rules: + if 'board' in info_data: + _log_warning(info_data, 'Board is specified in both info.json and rules.mk, the rules.mk value wins.') + + info_data['board'] = rules['BOARD'] + return info_data