Skip to content

Commit

Permalink
Update mdloader on Windows and add macOS binary (#104)
Browse files Browse the repository at this point in the history
* Update mdloader on Windows and add macOS binary

* Missed a comma
  • Loading branch information
fauxpark authored and drashna committed Aug 20, 2019
1 parent 3a1bbd9 commit fef9d07
Show file tree
Hide file tree
Showing 14 changed files with 33 additions and 6 deletions.
Binary file added common/applet-flash-samd51j18a.bin
Binary file not shown.
8 changes: 8 additions & 0 deletions osx/QMK Toolbox.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
303568C11FA7DEF400803BEF /* Constants.m in Sources */ = {isa = PBXBuildFile; fileRef = 303568C01FA7DEF400803BEF /* Constants.m */; };
3A7770DA22BD3BA300398C40 /* libftdi.1.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3A7770D822BD3B8200398C40 /* libftdi.1.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
C93A0FF42292232E0006C88F /* reset.eep in Resources */ = {isa = PBXBuildFile; fileRef = C93A0FF32292232D0006C88F /* reset.eep */; };
C9A09B5722EE6826008C3CF3 /* mdloader_mac in Resources */ = {isa = PBXBuildFile; fileRef = C9A09B5622EE6826008C3CF3 /* mdloader_mac */; };
C9A09B5922EE6837008C3CF3 /* applet-flash-samd51j18a.bin in Resources */ = {isa = PBXBuildFile; fileRef = C9A09B5822EE6837008C3CF3 /* applet-flash-samd51j18a.bin */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
Expand Down Expand Up @@ -76,6 +78,8 @@
303568C21FA7DF0900803BEF /* Constants.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Constants.h; sourceTree = "<group>"; };
3A7770D822BD3B8200398C40 /* libftdi.1.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; path = libftdi.1.dylib; sourceTree = SOURCE_ROOT; };
C93A0FF32292232D0006C88F /* reset.eep */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = reset.eep; path = ../../common/reset.eep; sourceTree = "<group>"; };
C9A09B5622EE6826008C3CF3 /* mdloader_mac */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; path = mdloader_mac; sourceTree = SOURCE_ROOT; };
C9A09B5822EE6837008C3CF3 /* applet-flash-samd51j18a.bin */ = {isa = PBXFileReference; lastKnownFileType = archive.macbinary; name = "applet-flash-samd51j18a.bin"; path = "../../common/applet-flash-samd51j18a.bin"; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -135,6 +139,8 @@
092963FE1F5C8B2C004F2D3F /* Supporting Files */ = {
isa = PBXGroup;
children = (
C9A09B5822EE6837008C3CF3 /* applet-flash-samd51j18a.bin */,
C9A09B5622EE6826008C3CF3 /* mdloader_mac */,
C93A0FF32292232D0006C88F /* reset.eep */,
3A7770D822BD3B8200398C40 /* libftdi.1.dylib */,
09D79CB51FB0DD7F0086ABF6 /* libusb-1.0.0.dylib */,
Expand Down Expand Up @@ -214,9 +220,11 @@
092964021F5C8B2C004F2D3F /* Assets.xcassets in Resources */,
09522BBB1F6216BA00AEBC5E /* avrdude.conf in Resources */,
098AEDFB1F5E45C300CA054D /* dfu-util in Resources */,
C9A09B5722EE6826008C3CF3 /* mdloader_mac in Resources */,
0929640F1F5E4068004F2D3F /* teensy_loader_cli in Resources */,
092964111F5E4186004F2D3F /* avrdude in Resources */,
092964051F5C8B2C004F2D3F /* MainMenu.xib in Resources */,
C9A09B5922EE6837008C3CF3 /* applet-flash-samd51j18a.bin in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
Binary file added osx/mdloader_mac
Binary file not shown.
1 change: 1 addition & 0 deletions osx/qmk_toolbox/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
[_printer printResponse:@" - Halfkay (Teensy, Ergodox EZ) via teensy_loader_cli (https://pjrc.com/teensy/loader_cli.html)\n" withType:MessageType_Info];
[_printer printResponse:@" - STM32 (ARM) via dfu-util (http://dfu-util.sourceforge.net/)\n" withType:MessageType_Info];
[_printer printResponse:@" - Kiibohd (ARM) via dfu-util (http://dfu-util.sourceforge.net/)\n" withType:MessageType_Info];
[_printer printResponse:@" - Atmel SAM-BA via mdloader (https://github.com/massdrop/mdloader)\n" withType:MessageType_Info];
[_printer printResponse:@"And the following ISP flasher protocols:\n" withType:MessageType_Info];
[_printer printResponse:@" - USBTiny (AVR Pocket)\n" withType:MessageType_Info];
[_printer printResponse:@" - AVRISP (Arduino ISP)\n" withType:MessageType_Info];
Expand Down
1 change: 1 addition & 0 deletions osx/qmk_toolbox/Flashing.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "Printing.h"

typedef enum {
AtmelSAMBA,
DFU,
Halfkay,
Caterina,
Expand Down
12 changes: 12 additions & 0 deletions osx/qmk_toolbox/Flashing.m
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,17 @@ - (void)flash:(NSString *)mcu withFile:(NSString *)file {
[self flashUSBAsp:mcu withFile:file];
if ([USB canFlash:USBTiny])
[self flashUSBTiny:mcu withFile:file];
if ([USB canFlash:AtmelSAMBA])
[self flashAtmelSAMBAwithFile:file];
}

- (void)reset:(NSString *)mcu {
if ([USB canFlash:DFU])
[self resetDFU:mcu];
if ([USB canFlash:Halfkay])
[self resetHalfkay:mcu];
if ([USB canFlash:AtmelSAMBA])
[self resetAtmelSAMBA];
}

- (void)eepromReset:(NSString *)mcu {
Expand Down Expand Up @@ -158,4 +162,12 @@ - (void)flashUSBAsp:(NSString *)mcu withFile:(NSString *)file {
[self runProcess:@"avrdude" withArgs:@[@"-p", mcu, @"-c", @"usbasp", @"-U", [NSString stringWithFormat:@"flash:w:%@:i", file], @"-C", @"avrdude.conf"]];
}

- (void)flashAtmelSAMBAwithFile: (NSString *)file {
[self runProcess:@"mdloader_mac" withArgs:@[@"-p", caterinaPort, @"-D", file]];
}

- (void)resetAtmelSAMBA {
[self runProcess:@"mdloader_mac" withArgs:@[@"-p", caterinaPort, @"--restart"]];
}

@end
4 changes: 4 additions & 0 deletions osx/qmk_toolbox/USB.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

//Global variables
static IONotificationPortRef gNotifyPort;
DEFINE_ITER(AtmelSAMBA);
DEFINE_ITER(DFU);
DEFINE_ITER(Caterina);
DEFINE_ITER(Halfkay);
Expand Down Expand Up @@ -47,6 +48,7 @@ + (void)setupWithPrinter:(Printing *)printer {

_printer = printer;
mach_port_t masterPort;
CFMutableDictionaryRef AtmelSAMBAMatchingDict;
CFMutableDictionaryRef DFUMatchingDict;
CFMutableDictionaryRef CaterinaMatchingDict;
CFMutableDictionaryRef CaterinaAltMatchingDict;
Expand Down Expand Up @@ -104,6 +106,7 @@ + (void)setupWithPrinter:(Printing *)printer {
dest##DeviceRemoved(NULL, g##dest##RemovedIter) \


VID_PID_MATCH(0x03EB, 0x6124, AtmelSAMBA);
VID_MATCH(0x03EB, DFU);
VID_MATCH(0x2341, Caterina);
VID_MATCH_MAP(0x1B4F, CaterinaAlt, Caterina);
Expand Down Expand Up @@ -190,6 +193,7 @@ + (void)setupWithPrinter:(Printing *)printer {
} \
}

DEVICE_EVENTS_PORT(AtmelSAMBA);
DEVICE_EVENTS(DFU);
DEVICE_EVENTS_PORT(Caterina);
DEVICE_EVENTS(Halfkay);
Expand Down
6 changes: 4 additions & 2 deletions windows/QMK Toolbox/Flashing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class Flashing : EventArgs
"reset.eep",
"dfu-prog-usb-1.2.2.zip",
"bootloadHID.exe",
"mdloadler64.exe",
"mdloader_windows.exe",
"applet-flash-samd51j18a.bin"
};

Expand Down Expand Up @@ -279,6 +279,8 @@ private void FlashUsbTiny(string mcu, string file)
private void FlashBootloadHID(string file) => RunProcess("bootloadHID.exe", $"-r \"{file}\"");
private void ResetBootloadHID() => RunProcess("bootloadHID.exe", $"-r");

private void FlashAtmelSamBa(string file) => RunProcess("mdloader64.exe", $"-p {CaterinaPort} -D \"{file}\"");
private void FlashAtmelSamBa(string file) => RunProcess("mdloader_windows.exe", $"-p {CaterinaPort} -D \"{file}\"");

private void ResetAtmelSamBa() => RunProcess("mdloader_windows.exe", $"-p {CaterinaPort} --restart");
}
}
2 changes: 1 addition & 1 deletion windows/QMK Toolbox/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ private void MainWindow_Load(object sender, EventArgs e)
_printer.PrintResponse(" - STM32 (ARM) via dfu-util (http://dfu-util.sourceforge.net/)\n", MessageType.Info);
_printer.PrintResponse(" - Kiibohd (ARM) via dfu-util (http://dfu-util.sourceforge.net/)\n", MessageType.Info);
_printer.PrintResponse(" - BootloadHID (Atmel, ps2avrGB, CA66) via bootloadHID (https://www.obdev.at/products/vusb/bootloadhid.html)\n", MessageType.Info);
_printer.PrintResponse(" - Atmel SAM-BA via mdloader (https://github.com/patrickmt/mdloader)\n", MessageType.Info);
_printer.PrintResponse(" - Atmel SAM-BA via mdloader (https://github.com/massdrop/mdloader)\n", MessageType.Info);
_printer.PrintResponse("And the following ISP flasher protocols:\n", MessageType.Info);
_printer.PrintResponse(" - USBTiny (AVR Pocket)\n", MessageType.Info);
_printer.PrintResponse(" - AVRISP (Arduino ISP)\n", MessageType.Info);
Expand Down
5 changes: 2 additions & 3 deletions windows/QMK Toolbox/QMK Toolbox.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@
<EmbeddedResource Include="..\..\common\avrdude.conf" />
<EmbeddedResource Include="..\..\common\reset.eep" />
<EmbeddedResource Include="dfu-prog-usb-1.2.2.zip" />
<EmbeddedResource Include="applet-flash-samd51j18a.bin" />
<EmbeddedResource Include="..\..\common\applet-flash-samd51j18a.bin" />
<None Include="packages.config" />
<None Include="Properties\app.manifest" />
<None Include="Properties\Settings.settings">
Expand Down Expand Up @@ -220,8 +220,7 @@
<EmbeddedResource Include="libusb0.dll" />
<EmbeddedResource Include="drivers.txt" />
<EmbeddedResource Include="bootloadHID.exe" />
<EmbeddedResource Include="mdloader.exe" />
<EmbeddedResource Include="mdloader64.exe" />
<EmbeddedResource Include="mdloader_windows.exe" />
<Content Include="output.ico" />
<EmbeddedResource Include="libusb-1.0.dll" />
<EmbeddedResource Include="teensy_loader_cli.exe" />
Expand Down
Binary file removed windows/QMK Toolbox/applet-flash-samd51j18a.bin
Binary file not shown.
Binary file removed windows/QMK Toolbox/mdloader.exe
Binary file not shown.
Binary file removed windows/QMK Toolbox/mdloader64.exe
Binary file not shown.
Binary file added windows/QMK Toolbox/mdloader_windows.exe
Binary file not shown.

0 comments on commit fef9d07

Please sign in to comment.