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

Added support of WB32 DFU for MacOs. #320

Merged
merged 21 commits into from
May 20, 2022
Merged
Show file tree
Hide file tree
Changes from 19 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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
- name: Check binary permissions
working-directory: ./macos/QMK Toolbox/Resources
env:
QMK_BINARIES: avrdude bootloadHID dfu-programmer dfu-util mdloader teensy_loader_cli
QMK_BINARIES: avrdude bootloadHID dfu-programmer dfu-util mdloader teensy_loader_cli wb32-dfu-updater_cli
run: |
status=0
for b in $QMK_BINARIES; do
Expand Down
10 changes: 10 additions & 0 deletions macos/QMK Toolbox.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
3AE6DA002726CB2600CECA21 /* STM32DuinoDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 3AE6D9FF2726CB2600CECA21 /* STM32DuinoDevice.m */; };
3AE6DA032726CB7A00CECA21 /* USBAspDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 3AE6DA022726CB7A00CECA21 /* USBAspDevice.m */; };
3AE6DA062726CBB200CECA21 /* USBTinyISPDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 3AE6DA052726CBB200CECA21 /* USBTinyISPDevice.m */; };
9B7999EF280AA1D0007469DA /* WB32DFUDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B7999EE280AA1D0007469DA /* WB32DFUDevice.m */; };
9BE10718275F4CFE00C708D5 /* wb32-dfu-updater_cli in Resources */ = {isa = PBXBuildFile; fileRef = 9BE10717275F4CFE00C708D5 /* wb32-dfu-updater_cli */; };
3AFD4BD1281AB86800ADCB65 /* libhidapi.0.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3AFD4BCF281AB83C00ADCB65 /* libhidapi.0.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
itarze marked this conversation as resolved.
Show resolved Hide resolved
C93A0FF42292232E0006C88F /* reset.eep in Resources */ = {isa = PBXBuildFile; fileRef = C93A0FF32292232D0006C88F /* reset.eep */; };
C9A09B5722EE6826008C3CF3 /* mdloader in Resources */ = {isa = PBXBuildFile; fileRef = C9A09B5622EE6826008C3CF3 /* mdloader */; };
Expand Down Expand Up @@ -148,6 +150,9 @@
3AE6DA022726CB7A00CECA21 /* USBAspDevice.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = USBAspDevice.m; sourceTree = "<group>"; };
3AE6DA042726CBB200CECA21 /* USBTinyISPDevice.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = USBTinyISPDevice.h; sourceTree = "<group>"; };
3AE6DA052726CBB200CECA21 /* USBTinyISPDevice.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = USBTinyISPDevice.m; sourceTree = "<group>"; };
9B7999ED280AA1C8007469DA /* WB32DFUDevice.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WB32DFUDevice.h; sourceTree = "<group>"; };
9B7999EE280AA1D0007469DA /* WB32DFUDevice.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = WB32DFUDevice.m; sourceTree = "<group>"; };
9BE10717275F4CFE00C708D5 /* wb32-dfu-updater_cli */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; path = "wb32-dfu-updater_cli"; sourceTree = "<group>"; };
3AFD4BCF281AB83C00ADCB65 /* libhidapi.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; path = libhidapi.0.dylib; sourceTree = "<group>"; };
itarze marked this conversation as resolved.
Show resolved Hide resolved
C93A0FF32292232D0006C88F /* reset.eep */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = reset.eep; path = ../../../common/reset.eep; sourceTree = "<group>"; };
C9A09B5622EE6826008C3CF3 /* mdloader */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; path = mdloader; sourceTree = "<group>"; };
Expand Down Expand Up @@ -241,6 +246,7 @@
3A7492CB27DF96BF0073A5A0 /* hid_bootloader_cli */,
C9A09B5622EE6826008C3CF3 /* mdloader */,
0929640E1F5E4068004F2D3F /* teensy_loader_cli */,
9BE10717275F4CFE00C708D5 /* wb32-dfu-updater_cli */,
3A7770D822BD3B8200398C40 /* libftdi.1.dylib */,
3AFD4BCF281AB83C00ADCB65 /* libhidapi.0.dylib */,
09D79CBB1FB8A6490086ABF6 /* libusb-0.1.4.dylib */,
Expand Down Expand Up @@ -308,6 +314,8 @@
3AE6DA022726CB7A00CECA21 /* USBAspDevice.m */,
3AE6DA042726CBB200CECA21 /* USBTinyISPDevice.h */,
3AE6DA052726CBB200CECA21 /* USBTinyISPDevice.m */,
9B7999ED280AA1C8007469DA /* WB32DFUDevice.h */,
9B7999EE280AA1D0007469DA /* WB32DFUDevice.m */,
);
path = Bootloader;
sourceTree = "<group>";
Expand Down Expand Up @@ -387,6 +395,7 @@
3A7492CC27DF96BF0073A5A0 /* hid_bootloader_cli in Resources */,
C9A09B5722EE6826008C3CF3 /* mdloader in Resources */,
0929640F1F5E4068004F2D3F /* teensy_loader_cli in Resources */,
9BE10718275F4CFE00C708D5 /* wb32-dfu-updater_cli in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -423,6 +432,7 @@
3AE6DA002726CB2600CECA21 /* STM32DuinoDevice.m in Sources */,
3AE6DA032726CB7A00CECA21 /* USBAspDevice.m in Sources */,
3AE6DA062726CBB200CECA21 /* USBTinyISPDevice.m in Sources */,
9B7999EF280AA1D0007469DA /* WB32DFUDevice.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
1 change: 1 addition & 0 deletions macos/QMK Toolbox/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
[self.logTextView logInfo:@" - Caterina (Arduino, Pro Micro) via avrdude (http://nongnu.org/avrdude/)"];
[self.logTextView logInfo:@" - HalfKay (Teensy, Ergodox EZ) via Teensy Loader (https://pjrc.com/teensy/loader_cli.html)"];
[self.logTextView logInfo:@" - LUFA/QMK HID via hid_bootloader_cli (https://github.com/abcminiuser/lufa)"];
[self.logTextView logInfo:@" - WB32 DFU via wb32-dfu-updater_cli (https://github.com/WestberryTech/wb32-dfu-updater)"];
[self.logTextView logInfo:@" - LUFA Mass Storage"];
[self.logTextView logInfo:@"Supported ISP flashers:"];
[self.logTextView logInfo:@" - AVRISP (Arduino ISP)"];
Expand Down
Binary file added macos/QMK Toolbox/Resources/wb32-dfu-updater_cli
Binary file not shown.
1 change: 1 addition & 0 deletions macos/QMK Toolbox/USB/Bootloader/BootloaderType.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ typedef enum BootloaderType : NSUInteger {
BootloaderTypeSTM32Duino,
BootloaderTypeUSBAsp,
BootloaderTypeUSBTinyISP,
BootloaderTypeWB32DFU,
BootloaderTypeNone
} BootloaderType;
4 changes: 4 additions & 0 deletions macos/QMK Toolbox/USB/Bootloader/WB32DFUDevice.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#import "BootloaderDevice.h"

@interface WB32DFUDevice : BootloaderDevice
@end
28 changes: 28 additions & 0 deletions macos/QMK Toolbox/USB/Bootloader/WB32DFUDevice.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#import "WB32DFUDevice.h"

@implementation WB32DFUDevice

- (id)initWithUSBDevice:(USBDevice *)usbDevice {
if (self = [super initWithUSBDevice:usbDevice]) {
self.name = @"WB32 DFU";
self.type = BootloaderTypeWB32DFU;
self.resettable = YES;
}
return self;
}

-(void)flashWithMCU:(NSString *)mcu file:(NSString *)file {
if([[[file pathExtension] lowercaseString] isEqualToString:@"bin"]) {
[self runProcess:@"wb32-dfu-updater_cli" withArgs:@[@"--toolbox-mode", @"--dfuse-address", @"0x08000000", @"--download", file]];
} else if([[[file pathExtension] lowercaseString] isEqualToString:@"hex"]) {
[self runProcess:@"wb32-dfu-updater_cli" withArgs:@[@"--toolbox-mode", @"--download", file]];
} else {
[self printMessage:@"Only firmware files in .bin or .hex format can be flashed with wb32-dfu-updater_cli!" withType:MessageType_Error];
}
}

-(void)resetWithMCU:(NSString *)mcu {
[self runProcess:@"wb32-dfu-updater_cli" withArgs:@[@"--reset"]];
}

@end
8 changes: 8 additions & 0 deletions macos/QMK Toolbox/USB/USBListener.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#import "STM32DuinoDevice.h"
#import "USBAspDevice.h"
#import "USBTinyISPDevice.h"
#import "WB32DFUDevice.h"

@implementation USBListener {
mach_port_t masterPort;
Expand Down Expand Up @@ -158,6 +159,8 @@ - (void)stop {
return [[USBAspDevice alloc] initWithUSBDevice:usbDevice];
case BootloaderTypeUSBTinyISP:
return [[USBTinyISPDevice alloc] initWithUSBDevice:usbDevice];
case BootloaderTypeWB32DFU:
return [[WB32DFUDevice alloc] initWithUSBDevice:usbDevice];
case BootloaderTypeNone:
default:
return usbDevice;
Expand Down Expand Up @@ -262,6 +265,11 @@ - (BootloaderType)deviceTypeForVendorID:(ushort)vendorID productID:(ushort)produ
return BootloaderTypeAPM32DFU;
}
break;
case 0x342D: // WestBerryTech
if (productID == 0xDFA0) {
return BootloaderTypeWB32DFU;
}
break;
}

return BootloaderTypeNone;
Expand Down