summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
m---------lib/chibios-contrib0
-rwxr-xr-xlib/python/qmk/cli/mass_compile.py17
-rw-r--r--lib/python/qmk/commands.py26
-rw-r--r--lib/python/qmk/constants.py7
-rw-r--r--lib/python/qmk/flashers.py18
5 files changed, 40 insertions, 28 deletions
diff --git a/lib/chibios-contrib b/lib/chibios-contrib
-Subproject a224be155ae18d38deccf33a6c1d259b9a5ad8d
+Subproject 5d2d95c520a13d2c3e42343f51b18822d63781d
diff --git a/lib/python/qmk/cli/mass_compile.py b/lib/python/qmk/cli/mass_compile.py
index 52c1cae4c2..ddd946a32b 100755
--- a/lib/python/qmk/cli/mass_compile.py
+++ b/lib/python/qmk/cli/mass_compile.py
@@ -53,20 +53,22 @@ def mass_compile(cli):
keyboard_name = target[0]
keymap_name = target[1]
keyboard_safe = keyboard_name.replace('/', '_')
+ build_log = f"{QMK_FIRMWARE}/.build/build.log.{os.getpid()}.{keyboard_safe}.{keymap_name}"
+ failed_log = f"{QMK_FIRMWARE}/.build/failed.log.{os.getpid()}.{keyboard_safe}.{keymap_name}"
# yapf: disable
f.write(
f"""\
all: {keyboard_safe}_{keymap_name}_binary
{keyboard_safe}_{keymap_name}_binary:
- @rm -f "{QMK_FIRMWARE}/.build/failed.log.{keyboard_safe}.{keymap_name}" || true
- @echo "Compiling QMK Firmware for target: '{keyboard_name}:{keymap_name}'..." >>"{QMK_FIRMWARE}/.build/build.log.{os.getpid()}.{keyboard_safe}"
+ @rm -f "{build_log}" || true
+ @echo "Compiling QMK Firmware for target: '{keyboard_name}:{keymap_name}'..." >>"{build_log}"
+@$(MAKE) -C "{QMK_FIRMWARE}" -f "{QMK_FIRMWARE}/builddefs/build_keyboard.mk" KEYBOARD="{keyboard_name}" KEYMAP="{keymap_name}" COLOR=true SILENT=false {' '.join(cli.args.env)} \\
- >>"{QMK_FIRMWARE}/.build/build.log.{os.getpid()}.{keyboard_safe}.{keymap_name}" 2>&1 \\
- || cp "{QMK_FIRMWARE}/.build/build.log.{os.getpid()}.{keyboard_safe}.{keymap_name}" "{QMK_FIRMWARE}/.build/failed.log.{os.getpid()}.{keyboard_safe}.{keymap_name}"
- @{{ grep '\[ERRORS\]' "{QMK_FIRMWARE}/.build/build.log.{os.getpid()}.{keyboard_safe}.{keymap_name}" >/dev/null 2>&1 && printf "Build %-64s \e[1;31m[ERRORS]\e[0m\\n" "{keyboard_name}:{keymap_name}" ; }} \\
- || {{ grep '\[WARNINGS\]' "{QMK_FIRMWARE}/.build/build.log.{os.getpid()}.{keyboard_safe}.{keymap_name}" >/dev/null 2>&1 && printf "Build %-64s \e[1;33m[WARNINGS]\e[0m\\n" "{keyboard_name}:{keymap_name}" ; }} \\
+ >>"{build_log}" 2>&1 \\
+ || cp "{build_log}" "{failed_log}"
+ @{{ grep '\[ERRORS\]' "{build_log}" >/dev/null 2>&1 && printf "Build %-64s \e[1;31m[ERRORS]\e[0m\\n" "{keyboard_name}:{keymap_name}" ; }} \\
+ || {{ grep '\[WARNINGS\]' "{build_log}" >/dev/null 2>&1 && printf "Build %-64s \e[1;33m[WARNINGS]\e[0m\\n" "{keyboard_name}:{keymap_name}" ; }} \\
|| printf "Build %-64s \e[1;32m[OK]\e[0m\\n" "{keyboard_name}:{keymap_name}"
- @rm -f "{QMK_FIRMWARE}/.build/build.log.{os.getpid()}.{keyboard_safe}.{keymap_name}" || true
+ @rm -f "{build_log}" || true
"""# noqa
)
# yapf: enable
@@ -77,7 +79,6 @@ all: {keyboard_safe}_{keymap_name}_binary
f"""\
@rm -rf "{QMK_FIRMWARE}/.build/{keyboard_safe}_{keymap_name}.elf" 2>/dev/null || true
@rm -rf "{QMK_FIRMWARE}/.build/{keyboard_safe}_{keymap_name}.map" 2>/dev/null || true
- @rm -rf "{QMK_FIRMWARE}/.build/obj_{keyboard_safe}" || true
@rm -rf "{QMK_FIRMWARE}/.build/obj_{keyboard_safe}_{keymap_name}" || true
"""# noqa
)
diff --git a/lib/python/qmk/commands.py b/lib/python/qmk/commands.py
index b1eac13957..ab8e323edf 100644
--- a/lib/python/qmk/commands.py
+++ b/lib/python/qmk/commands.py
@@ -9,7 +9,7 @@ from pathlib import Path
from milc import cli
import jsonschema
-from qmk.constants import KEYBOARD_OUTPUT_PREFIX
+from qmk.constants import INTERMEDIATE_OUTPUT_PREFIX
from qmk.json_schema import json_load, validate
@@ -134,16 +134,13 @@ def compile_configurator_json(user_keymap, bootloader=None, parallel=1, clean=Fa
keyboard_filesafe = user_keymap['keyboard'].replace('/', '_')
target = f'{keyboard_filesafe}_{user_keymap["keymap"]}'
- keyboard_output = Path(f'{KEYBOARD_OUTPUT_PREFIX}{keyboard_filesafe}')
- keymap_output = Path(f'{keyboard_output}_{user_keymap["keymap"]}')
- keymap_dir = keymap_output / 'src'
+ intermediate_output = Path(f'{INTERMEDIATE_OUTPUT_PREFIX}{keyboard_filesafe}_{user_keymap["keymap"]}')
+ keymap_dir = intermediate_output / 'src'
keymap_json = keymap_dir / 'keymap.json'
if clean:
- if keyboard_output.exists():
- shutil.rmtree(keyboard_output)
- if keymap_output.exists():
- shutil.rmtree(keymap_output)
+ if intermediate_output.exists():
+ shutil.rmtree(intermediate_output)
# begin with making the deepest folder in the tree
keymap_dir.mkdir(exist_ok=True, parents=True)
@@ -183,13 +180,12 @@ def compile_configurator_json(user_keymap, bootloader=None, parallel=1, clean=Fa
f'KEYMAP={user_keymap["keymap"]}',
f'KEYBOARD_FILESAFE={keyboard_filesafe}',
f'TARGET={target}',
- f'KEYBOARD_OUTPUT={keyboard_output}',
- f'KEYMAP_OUTPUT={keymap_output}',
- f'MAIN_KEYMAP_PATH_1={keymap_output}',
- f'MAIN_KEYMAP_PATH_2={keymap_output}',
- f'MAIN_KEYMAP_PATH_3={keymap_output}',
- f'MAIN_KEYMAP_PATH_4={keymap_output}',
- f'MAIN_KEYMAP_PATH_5={keymap_output}',
+ f'INTERMEDIATE_OUTPUT={intermediate_output}',
+ f'MAIN_KEYMAP_PATH_1={intermediate_output}',
+ f'MAIN_KEYMAP_PATH_2={intermediate_output}',
+ f'MAIN_KEYMAP_PATH_3={intermediate_output}',
+ f'MAIN_KEYMAP_PATH_4={intermediate_output}',
+ f'MAIN_KEYMAP_PATH_5={intermediate_output}',
f'KEYMAP_JSON={keymap_json}',
f'KEYMAP_PATH={keymap_dir}',
f'VERBOSE={verbose}',
diff --git a/lib/python/qmk/constants.py b/lib/python/qmk/constants.py
index 8a13029a8a..97bd84aa23 100644
--- a/lib/python/qmk/constants.py
+++ b/lib/python/qmk/constants.py
@@ -14,7 +14,7 @@ QMK_FIRMWARE_UPSTREAM = 'qmk/qmk_firmware'
MAX_KEYBOARD_SUBFOLDERS = 5
# Supported processor types
-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', 'STM32L412', 'STM32L422', 'STM32L432', 'STM32L433', 'STM32L442', 'STM32L443', 'GD32VF103', 'WB32F3G71', 'WB32FQ95'
+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'
LUFA_PROCESSORS = 'at90usb162', 'atmega16u2', 'atmega32u2', 'atmega16u4', 'atmega32u4', 'at90usb646', 'at90usb647', 'at90usb1286', 'at90usb1287', None
VUSB_PROCESSORS = 'atmega32a', 'atmega328p', 'atmega328', 'attiny85'
@@ -36,6 +36,8 @@ MCU2BOOTLOADER = {
"STM32F446": "stm32-dfu",
"STM32G431": "stm32-dfu",
"STM32G474": "stm32-dfu",
+ "STM32H723": "stm32-dfu",
+ "STM32H733": "stm32-dfu",
"STM32L412": "stm32-dfu",
"STM32L422": "stm32-dfu",
"STM32L432": "stm32-dfu",
@@ -82,6 +84,7 @@ BOOTLOADER_VIDS_PIDS = {
},
'apm32-dfu': {("314b", "0106")},
'gd32v-dfu': {("28e9", "0189")},
+ 'wb32-dfu': {("342d", "dfa0")},
'bootloadhid': {("16c0", "05df")},
'usbasploader': {("16c0", "05dc")},
'usbtinyisp': {("1782", "0c9f")},
@@ -123,7 +126,7 @@ ROW_LETTERS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnop'
# Constants that should match their counterparts in make
BUILD_DIR = environ.get('BUILD_DIR', '.build')
-KEYBOARD_OUTPUT_PREFIX = f'{BUILD_DIR}/obj_'
+INTERMEDIATE_OUTPUT_PREFIX = f'{BUILD_DIR}/obj_'
# Headers for generated files
GPL2_HEADER_C_LIKE = f'''\
diff --git a/lib/python/qmk/flashers.py b/lib/python/qmk/flashers.py
index f83665d9ac..9ecb5e4b9c 100644
--- a/lib/python/qmk/flashers.py
+++ b/lib/python/qmk/flashers.py
@@ -96,7 +96,7 @@ def _find_bootloader():
details = 'halfkay'
else:
details = 'qmk-hid'
- elif bl == 'stm32-dfu' or bl == 'apm32-dfu' or bl == 'gd32v-dfu' or bl == 'kiibohd':
+ elif bl in {'apm32-dfu', 'gd32v-dfu', 'kiibohd', 'stm32-dfu'}:
details = (vid, pid)
else:
details = None
@@ -181,9 +181,18 @@ def _flash_dfu_util(details, file):
cli.run(['dfu-util', '-a', '0', '-d', f'{details[0]}:{details[1]}', '-s', '0x08000000:leave', '-D', file], capture_output=False)
+def _flash_wb32_dfu_updater(file):
+ if shutil.which('wb32-dfu-updater_cli'):
+ cmd = 'wb32-dfu-updater_cli'
+ else:
+ return True
+
+ cli.run([cmd, '-t', '-s', '0x08000000', '-D', file], capture_output=False)
+
+
def _flash_isp(mcu, programmer, file):
programmer = 'usbasp' if programmer == 'usbasploader' else 'usbtiny'
- # Check if the provide mcu has an avrdude-specific name, otherwise pass on what the user provided
+ # Check if the provided mcu has an avrdude-specific name, otherwise pass on what the user provided
mcu = AVRDUDE_MCU.get(mcu, mcu)
cli.run(['avrdude', '-p', mcu, '-c', programmer, '-U', f'flash:w:{file}:i'], capture_output=False)
@@ -211,8 +220,11 @@ def flasher(mcu, file):
return (True, "Please make sure 'teensy_loader_cli' or 'hid_bootloader_cli' is available on your system.")
else:
return (True, "Specifying the MCU with '-m' is necessary for HalfKay/HID bootloaders!")
- elif bl == 'stm32-dfu' or bl == 'apm32-dfu' or bl == 'gd32v-dfu' or bl == 'kiibohd':
+ elif bl in {'apm32-dfu', 'gd32v-dfu', 'kiibohd', 'stm32-dfu'}:
_flash_dfu_util(details, file)
+ elif bl == 'wb32-dfu':
+ if _flash_wb32_dfu_updater(file):
+ return (True, "Please make sure 'wb32-dfu-updater_cli' is available on your system.")
elif bl == 'usbasploader' or bl == 'usbtinyisp':
if mcu:
_flash_isp(mcu, bl, file)