Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for specifying BOARD in info.json #11492

Merged
merged 4 commits into from
Jan 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions data/schemas/keyboard.jsonschema
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
1 change: 1 addition & 0 deletions keyboards/clueboard/60/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"width": 15,
"debounce": 6,
"processor": "STM32F303",
"board": "QMK_PROTON_C",
"diode_direction": "COL2ROW",
"features": {
"audio": true,
Expand Down
2 changes: 0 additions & 2 deletions keyboards/clueboard/60/rules.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
BOARD = QMK_PROTON_C

# project specific files
SRC = led.c
1 change: 1 addition & 0 deletions keyboards/clueboard/66/rev4/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"width": 16.5,
"debounce": 5,
"processor": "STM32F303",
"board": "QMK_PROTON_C",
"diode_direction": "COL2ROW",
"features": {
"audio": true,
Expand Down
1 change: 0 additions & 1 deletion keyboards/clueboard/66/rev4/rules.mk
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
BOARD = QMK_PROTON_C
# This file intentionally left blank
1 change: 1 addition & 0 deletions keyboards/clueboard/66_hotswap/gen1/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"width": 16.5,
"debounce": 5,
"processor": "STM32F303",
"board": "QMK_PROTON_C",
"diode_direction": "COL2ROW",
"features": {
"audio": true,
Expand Down
1 change: 0 additions & 1 deletion keyboards/clueboard/66_hotswap/gen1/rules.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
BOARD = QMK_PROTON_C
LED_MATRIX_DRIVER = IS31FL3731

# project specific files
Expand Down
1 change: 1 addition & 0 deletions keyboards/clueboard/california/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"url": "",
"maintainer": "skullydazed",
"processor": "STM32F303",
"board": "QMK_PROTON_C",
"matrix_pins": {
"direct": [
["A10", "A9"],
Expand Down
1 change: 0 additions & 1 deletion keyboards/clueboard/california/rules.mk
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
BOARD = QMK_PROTON_C
# This file intentionally left blank
2 changes: 0 additions & 2 deletions keyboards/cmm_studio/saka68/info.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{
"keyboard_name": "",
"url": "",
"maintainer": "qmk",
"width": 17.25,
"height": 5,
Expand Down
4 changes: 3 additions & 1 deletion lib/python/qmk/cli/generate/rules_mk.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from qmk.path import is_keyboard, normpath

info_to_rules = {
'board': 'BOARD',
'bootloader': 'BOOTLOADER',
'processor': 'MCU',
}
Expand Down Expand Up @@ -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:
Expand Down
8 changes: 7 additions & 1 deletion lib/python/qmk/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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


Expand Down