2020-02-18 01:42:11 +06:00
|
|
|
"""Information that should be available to the python library.
|
|
|
|
"""
|
2021-01-17 05:13:04 +06:00
|
|
|
from os import environ
|
2022-03-18 07:09:29 +06:00
|
|
|
from datetime import date
|
2020-02-18 01:42:11 +06:00
|
|
|
from pathlib import Path
|
|
|
|
|
2023-11-28 02:53:43 +06:00
|
|
|
from qmk.userspace import detect_qmk_userspace
|
|
|
|
|
2020-02-18 01:42:11 +06:00
|
|
|
# The root of the qmk_firmware tree.
|
|
|
|
QMK_FIRMWARE = Path.cwd()
|
|
|
|
|
2023-11-28 02:53:43 +06:00
|
|
|
# The detected userspace tree
|
|
|
|
QMK_USERSPACE = detect_qmk_userspace()
|
|
|
|
|
|
|
|
# Whether or not we have a separate userspace directory
|
|
|
|
HAS_QMK_USERSPACE = True if QMK_USERSPACE is not None else False
|
|
|
|
|
2021-07-10 21:04:50 +06:00
|
|
|
# Upstream repo url
|
|
|
|
QMK_FIRMWARE_UPSTREAM = 'qmk/qmk_firmware'
|
|
|
|
|
2020-02-18 01:42:11 +06:00
|
|
|
# This is the number of directories under `qmk_firmware/keyboards` that will be traversed. This is currently a limitation of our make system.
|
|
|
|
MAX_KEYBOARD_SUBFOLDERS = 5
|
2020-05-27 02:05:41 +06:00
|
|
|
|
|
|
|
# Supported processor types
|
2023-06-28 09:07:14 +06:00
|
|
|
CHIBIOS_PROCESSORS = 'cortex-m0', 'cortex-m0plus', 'cortex-m3', 'cortex-m4', 'MKL26Z64', 'MK20DX128', 'MK20DX256', 'MK64FX512', 'MK66FX1M0', 'RP2040', 'STM32F042', 'STM32F072', 'STM32F103', 'STM32F303', 'STM32F401', 'STM32F405', 'STM32F407', 'STM32F411', 'STM32F446', 'STM32G431', 'STM32G474', 'STM32H723', 'STM32H733', 'STM32L412', 'STM32L422', 'STM32L432', 'STM32L433', 'STM32L442', 'STM32L443', 'GD32VF103', 'WB32F3G71', 'WB32FQ95'
|
2021-01-30 09:53:56 +06:00
|
|
|
LUFA_PROCESSORS = 'at90usb162', 'atmega16u2', 'atmega32u2', 'atmega16u4', 'atmega32u4', 'at90usb646', 'at90usb647', 'at90usb1286', 'at90usb1287', None
|
2020-10-09 06:43:07 +06:00
|
|
|
VUSB_PROCESSORS = 'atmega32a', 'atmega328p', 'atmega328', 'attiny85'
|
2020-10-26 03:48:44 +06:00
|
|
|
|
2022-02-14 17:02:35 +06:00
|
|
|
# Bootloaders of the supported processors
|
|
|
|
MCU2BOOTLOADER = {
|
2022-08-19 06:48:33 +06:00
|
|
|
"RP2040": "rp2040",
|
2022-02-14 17:02:35 +06:00
|
|
|
"MKL26Z64": "halfkay",
|
|
|
|
"MK20DX128": "halfkay",
|
|
|
|
"MK20DX256": "halfkay",
|
|
|
|
"MK66FX1M0": "halfkay",
|
|
|
|
"STM32F042": "stm32-dfu",
|
|
|
|
"STM32F072": "stm32-dfu",
|
|
|
|
"STM32F103": "stm32duino",
|
|
|
|
"STM32F303": "stm32-dfu",
|
|
|
|
"STM32F401": "stm32-dfu",
|
|
|
|
"STM32F405": "stm32-dfu",
|
|
|
|
"STM32F407": "stm32-dfu",
|
|
|
|
"STM32F411": "stm32-dfu",
|
|
|
|
"STM32F446": "stm32-dfu",
|
|
|
|
"STM32G431": "stm32-dfu",
|
|
|
|
"STM32G474": "stm32-dfu",
|
2023-06-28 09:07:14 +06:00
|
|
|
"STM32H723": "stm32-dfu",
|
|
|
|
"STM32H733": "stm32-dfu",
|
2022-02-14 17:02:35 +06:00
|
|
|
"STM32L412": "stm32-dfu",
|
|
|
|
"STM32L422": "stm32-dfu",
|
|
|
|
"STM32L432": "stm32-dfu",
|
|
|
|
"STM32L433": "stm32-dfu",
|
|
|
|
"STM32L442": "stm32-dfu",
|
|
|
|
"STM32L443": "stm32-dfu",
|
|
|
|
"GD32VF103": "gd32v-dfu",
|
|
|
|
"WB32F3G71": "wb32-dfu",
|
2022-05-23 11:57:24 +06:00
|
|
|
"WB32FQ95": "wb32-dfu",
|
2022-02-14 17:02:35 +06:00
|
|
|
"atmega16u2": "atmel-dfu",
|
|
|
|
"atmega32u2": "atmel-dfu",
|
|
|
|
"atmega16u4": "atmel-dfu",
|
|
|
|
"atmega32u4": "atmel-dfu",
|
|
|
|
"at90usb162": "atmel-dfu",
|
|
|
|
"at90usb646": "atmel-dfu",
|
|
|
|
"at90usb647": "atmel-dfu",
|
|
|
|
"at90usb1286": "atmel-dfu",
|
|
|
|
"at90usb1287": "atmel-dfu",
|
|
|
|
"atmega32a": "bootloadhid",
|
|
|
|
"atmega328p": "usbasploader",
|
|
|
|
"atmega328": "usbasploader",
|
|
|
|
}
|
|
|
|
|
2022-08-13 19:39:56 +06:00
|
|
|
# Map of legacy keycodes that can be automatically updated
|
|
|
|
LEGACY_KEYCODES = { # Comment here is to force multiline formatting
|
|
|
|
'RESET': 'QK_BOOT'
|
|
|
|
}
|
|
|
|
|
2022-08-20 11:39:19 +06:00
|
|
|
# Map VID:PID values to bootloaders
|
|
|
|
BOOTLOADER_VIDS_PIDS = {
|
|
|
|
'atmel-dfu': {
|
|
|
|
("03eb", "2fef"), # ATmega16U2
|
|
|
|
("03eb", "2ff0"), # ATmega32U2
|
|
|
|
("03eb", "2ff3"), # ATmega16U4
|
|
|
|
("03eb", "2ff4"), # ATmega32U4
|
|
|
|
("03eb", "2ff9"), # AT90USB64
|
|
|
|
("03eb", "2ffa"), # AT90USB162
|
|
|
|
("03eb", "2ffb") # AT90USB128
|
|
|
|
},
|
|
|
|
'kiibohd': {("1c11", "b007")},
|
|
|
|
'stm32-dfu': {
|
|
|
|
("1eaf", "0003"), # STM32duino
|
|
|
|
("0483", "df11") # STM32 DFU
|
|
|
|
},
|
|
|
|
'apm32-dfu': {("314b", "0106")},
|
|
|
|
'gd32v-dfu': {("28e9", "0189")},
|
2023-07-07 20:48:45 +06:00
|
|
|
'wb32-dfu': {("342d", "dfa0")},
|
2022-08-20 11:39:19 +06:00
|
|
|
'bootloadhid': {("16c0", "05df")},
|
|
|
|
'usbasploader': {("16c0", "05dc")},
|
|
|
|
'usbtinyisp': {("1782", "0c9f")},
|
|
|
|
'md-boot': {("03eb", "6124")},
|
|
|
|
'caterina': {
|
|
|
|
# pid.codes shared PID
|
2022-08-20 20:59:17 +06:00
|
|
|
("1209", "2302"), # Keyboardio Atreus 2 Bootloader
|
2022-08-20 11:39:19 +06:00
|
|
|
# Spark Fun Electronics
|
|
|
|
("1b4f", "9203"), # Pro Micro 3V3/8MHz
|
|
|
|
("1b4f", "9205"), # Pro Micro 5V/16MHz
|
|
|
|
("1b4f", "9207"), # LilyPad 3V3/8MHz (and some Pro Micro clones)
|
|
|
|
# Pololu Electronics
|
|
|
|
("1ffb", "0101"), # A-Star 32U4
|
|
|
|
# Arduino SA
|
|
|
|
("2341", "0036"), # Leonardo
|
|
|
|
("2341", "0037"), # Micro
|
|
|
|
# Adafruit Industries LLC
|
|
|
|
("239a", "000c"), # Feather 32U4
|
|
|
|
("239a", "000d"), # ItsyBitsy 32U4 3V3/8MHz
|
|
|
|
("239a", "000e"), # ItsyBitsy 32U4 5V/16MHz
|
|
|
|
# dog hunter AG
|
|
|
|
("2a03", "0036"), # Leonardo
|
|
|
|
("2a03", "0037") # Micro
|
|
|
|
},
|
|
|
|
'hid-bootloader': {
|
|
|
|
("03eb", "2067"), # QMK HID
|
|
|
|
("16c0", "0478") # PJRC halfkay
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-26 03:48:44 +06:00
|
|
|
# Common format strings
|
|
|
|
DATE_FORMAT = '%Y-%m-%d'
|
|
|
|
DATETIME_FORMAT = '%Y-%m-%d %H:%M:%S %Z'
|
|
|
|
TIME_FORMAT = '%H:%M:%S'
|
2020-12-31 00:27:37 +06:00
|
|
|
|
|
|
|
# Used when generating matrix locations
|
|
|
|
COL_LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijilmnopqrstuvwxyz'
|
|
|
|
ROW_LETTERS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnop'
|
|
|
|
|
2021-01-17 05:13:04 +06:00
|
|
|
# Constants that should match their counterparts in make
|
|
|
|
BUILD_DIR = environ.get('BUILD_DIR', '.build')
|
2023-06-21 04:41:49 +06:00
|
|
|
INTERMEDIATE_OUTPUT_PREFIX = f'{BUILD_DIR}/obj_'
|
2022-03-18 07:09:29 +06:00
|
|
|
|
|
|
|
# Headers for generated files
|
|
|
|
GPL2_HEADER_C_LIKE = f'''\
|
|
|
|
// Copyright {date.today().year} QMK
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
'''
|
|
|
|
|
|
|
|
GPL2_HEADER_SH_LIKE = f'''\
|
|
|
|
# Copyright {date.today().year} QMK
|
|
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
'''
|
|
|
|
|
|
|
|
GENERATED_HEADER_C_LIKE = '''\
|
|
|
|
/*******************************************************************************
|
|
|
|
88888888888 888 d8b .d888 d8b 888 d8b
|
|
|
|
888 888 Y8P d88P" Y8P 888 Y8P
|
|
|
|
888 888 888 888
|
|
|
|
888 88888b. 888 .d8888b 888888 888 888 .d88b. 888 .d8888b
|
|
|
|
888 888 "88b 888 88K 888 888 888 d8P Y8b 888 88K
|
|
|
|
888 888 888 888 "Y8888b. 888 888 888 88888888 888 "Y8888b.
|
|
|
|
888 888 888 888 X88 888 888 888 Y8b. 888 X88
|
|
|
|
888 888 888 888 88888P' 888 888 888 "Y8888 888 88888P'
|
|
|
|
888 888
|
|
|
|
888 888
|
|
|
|
888 888
|
|
|
|
.d88b. .d88b. 88888b. .d88b. 888d888 8888b. 888888 .d88b. .d88888
|
|
|
|
d88P"88b d8P Y8b 888 "88b d8P Y8b 888P" "88b 888 d8P Y8b d88" 888
|
|
|
|
888 888 88888888 888 888 88888888 888 .d888888 888 88888888 888 888
|
|
|
|
Y88b 888 Y8b. 888 888 Y8b. 888 888 888 Y88b. Y8b. Y88b 888
|
|
|
|
"Y88888 "Y8888 888 888 "Y8888 888 "Y888888 "Y888 "Y8888 "Y88888
|
|
|
|
888
|
|
|
|
Y8b d88P
|
|
|
|
"Y88P"
|
|
|
|
*******************************************************************************/
|
|
|
|
'''
|
|
|
|
|
|
|
|
GENERATED_HEADER_SH_LIKE = '''\
|
|
|
|
################################################################################
|
|
|
|
#
|
|
|
|
# 88888888888 888 d8b .d888 d8b 888 d8b
|
|
|
|
# 888 888 Y8P d88P" Y8P 888 Y8P
|
|
|
|
# 888 888 888 888
|
|
|
|
# 888 88888b. 888 .d8888b 888888 888 888 .d88b. 888 .d8888b
|
|
|
|
# 888 888 "88b 888 88K 888 888 888 d8P Y8b 888 88K
|
|
|
|
# 888 888 888 888 "Y8888b. 888 888 888 88888888 888 "Y8888b.
|
|
|
|
# 888 888 888 888 X88 888 888 888 Y8b. 888 X88
|
|
|
|
# 888 888 888 888 88888P' 888 888 888 "Y8888 888 88888P'
|
|
|
|
#
|
|
|
|
# 888 888
|
|
|
|
# 888 888
|
|
|
|
# 888 888
|
|
|
|
# .d88b. .d88b. 88888b. .d88b. 888d888 8888b. 888888 .d88b. .d88888
|
|
|
|
# d88P"88b d8P Y8b 888 "88b d8P Y8b 888P" "88b 888 d8P Y8b d88" 888
|
|
|
|
# 888 888 88888888 888 888 88888888 888 .d888888 888 88888888 888 888
|
|
|
|
# Y88b 888 Y8b. 888 888 Y8b. 888 888 888 Y88b. Y8b. Y88b 888
|
|
|
|
# "Y88888 "Y8888 888 888 "Y8888 888 "Y888888 "Y888 "Y8888 "Y88888
|
|
|
|
# 888
|
|
|
|
# Y8b d88P
|
|
|
|
# "Y88P"
|
|
|
|
#
|
|
|
|
################################################################################
|
|
|
|
'''
|
2023-11-11 15:50:33 +06:00
|
|
|
|
|
|
|
LICENSE_TEXTS = [
|
|
|
|
(
|
|
|
|
'GPL-2.0-or-later', [
|
|
|
|
"""\
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
""", """\
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or any later version.
|
|
|
|
"""
|
|
|
|
]
|
|
|
|
),
|
|
|
|
('GPL-2.0-only', ["""\
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License as
|
|
|
|
published by the Free Software Foundation; version 2.
|
|
|
|
"""]),
|
|
|
|
(
|
|
|
|
'GPL-3.0-or-later', [
|
|
|
|
"""\
|
|
|
|
This program is free software: you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License as
|
|
|
|
published by the Free Software Foundation, either version 3 of
|
|
|
|
the License, or (at your option) any later version.
|
|
|
|
""", """\
|
|
|
|
This program is free software: you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License as
|
|
|
|
published by the Free Software Foundation, either version 3 of
|
|
|
|
the License, or any later version.
|
|
|
|
"""
|
|
|
|
]
|
|
|
|
),
|
|
|
|
('GPL-3.0-only', ["""\
|
|
|
|
This program is free software: you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License as
|
|
|
|
published by the Free Software Foundation, version 3.
|
|
|
|
"""]),
|
|
|
|
(
|
|
|
|
'LGPL-2.1-or-later', [
|
|
|
|
"""\
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2.1
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
""", """\
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2.1
|
|
|
|
of the License, or any later version.
|
|
|
|
""", """\
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2.1
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
""", """\
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2.1
|
|
|
|
of the License, or any later version.
|
|
|
|
"""
|
|
|
|
]
|
|
|
|
),
|
|
|
|
(
|
|
|
|
'LGPL-2.1-only', [
|
|
|
|
"""\
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public License as
|
|
|
|
published by the Free Software Foundation; version 2.1.
|
|
|
|
""", """\
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public License as
|
|
|
|
published by the Free Software Foundation; version 2.1.
|
|
|
|
"""
|
|
|
|
]
|
|
|
|
),
|
|
|
|
(
|
|
|
|
'LGPL-3.0-or-later', [
|
|
|
|
"""\
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public License
|
|
|
|
as published by the Free Software Foundation; either version 3
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
""", """\
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public License
|
|
|
|
as published by the Free Software Foundation; either version 3
|
|
|
|
of the License, or any later version.
|
|
|
|
""", """\
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public License
|
|
|
|
as published by the Free Software Foundation; either version 3
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
""", """\
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public License
|
|
|
|
as published by the Free Software Foundation; either version 3
|
|
|
|
of the License, or any later version.
|
|
|
|
"""
|
|
|
|
]
|
|
|
|
),
|
|
|
|
(
|
|
|
|
'LGPL-3.0-only', [
|
|
|
|
"""\
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public License as
|
|
|
|
published by the Free Software Foundation; version 3.
|
|
|
|
""", """\
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public License as
|
|
|
|
published by the Free Software Foundation; version 3.
|
|
|
|
"""
|
|
|
|
]
|
|
|
|
),
|
|
|
|
('Apache-2.0', ["""\
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
"""]),
|
|
|
|
]
|