feat, docs: WB32 flashing (#21217)
This commit is contained in:
parent
a8a87a0922
commit
a0ea7a6b17
3 changed files with 39 additions and 3 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue