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

Use a single generic eep file for resetting EEPROM #75

Merged
merged 2 commits into from
May 20, 2019
Merged
Show file tree
Hide file tree
Changes from all 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
9 changes: 0 additions & 9 deletions common/atmega32u4_eeprom_reset.hex

This file was deleted.

2 changes: 2 additions & 0 deletions common/reset.eep
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
:0100000000FF
:00000001FF
8 changes: 4 additions & 4 deletions osx/QMK Toolbox.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
0929640F1F5E4068004F2D3F /* teensy_loader_cli in Resources */ = {isa = PBXBuildFile; fileRef = 0929640E1F5E4068004F2D3F /* teensy_loader_cli */; };
092964111F5E4186004F2D3F /* avrdude in Resources */ = {isa = PBXBuildFile; fileRef = 092964101F5E4186004F2D3F /* avrdude */; };
09522BB31F61E32700AEBC5E /* mcu-list.txt in Resources */ = {isa = PBXBuildFile; fileRef = 09522BB21F61E32700AEBC5E /* mcu-list.txt */; };
09522BB71F61E33B00AEBC5E /* atmega32u4_eeprom_reset.hex in Resources */ = {isa = PBXBuildFile; fileRef = 09522BB61F61E33B00AEBC5E /* atmega32u4_eeprom_reset.hex */; };
09522BBB1F6216BA00AEBC5E /* avrdude.conf in Resources */ = {isa = PBXBuildFile; fileRef = 09522BBA1F6216BA00AEBC5E /* avrdude.conf */; };
098AEDFB1F5E45C300CA054D /* dfu-util in Resources */ = {isa = PBXBuildFile; fileRef = 098AEDFA1F5E45C300CA054D /* dfu-util */; };
098AEDFE1F5F220500CA054D /* Printing.m in Sources */ = {isa = PBXBuildFile; fileRef = 098AEDFD1F5F220500CA054D /* Printing.m */; };
Expand All @@ -27,6 +26,7 @@
09D79CBA1FB8A6360086ABF6 /* libusb-1.0.0.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 09D79CB51FB0DD7F0086ABF6 /* libusb-1.0.0.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
09D79CBC1FB8A64B0086ABF6 /* libusb-0.1.4.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 09D79CBB1FB8A6490086ABF6 /* libusb-0.1.4.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
303568C11FA7DEF400803BEF /* Constants.m in Sources */ = {isa = PBXBuildFile; fileRef = 303568C01FA7DEF400803BEF /* Constants.m */; };
C93A0FF42292232E0006C88F /* reset.eep in Resources */ = {isa = PBXBuildFile; fileRef = C93A0FF32292232D0006C88F /* reset.eep */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
Expand Down Expand Up @@ -55,7 +55,6 @@
0929640E1F5E4068004F2D3F /* teensy_loader_cli */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; name = teensy_loader_cli; path = ../teensy_loader_cli; sourceTree = "<group>"; };
092964101F5E4186004F2D3F /* avrdude */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; name = avrdude; path = ../avrdude; sourceTree = "<group>"; };
09522BB21F61E32700AEBC5E /* mcu-list.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = "mcu-list.txt"; path = "../../common/mcu-list.txt"; sourceTree = "<group>"; };
09522BB61F61E33B00AEBC5E /* atmega32u4_eeprom_reset.hex */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = atmega32u4_eeprom_reset.hex; path = ../../common/atmega32u4_eeprom_reset.hex; sourceTree = "<group>"; };
09522BBA1F6216BA00AEBC5E /* avrdude.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = avrdude.conf; path = ../../common/avrdude.conf; sourceTree = "<group>"; };
098AEDFA1F5E45C300CA054D /* dfu-util */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; name = "dfu-util"; path = "../dfu-util"; sourceTree = "<group>"; };
098AEDFC1F5F220500CA054D /* Printing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = Printing.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
Expand All @@ -73,6 +72,7 @@
09D79CBB1FB8A6490086ABF6 /* libusb-0.1.4.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; path = "libusb-0.1.4.dylib"; sourceTree = SOURCE_ROOT; };
303568C01FA7DEF400803BEF /* Constants.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Constants.m; sourceTree = "<group>"; };
303568C21FA7DF0900803BEF /* Constants.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Constants.h; sourceTree = "<group>"; };
C93A0FF32292232D0006C88F /* reset.eep */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = reset.eep; path = ../../common/reset.eep; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -132,10 +132,10 @@
092963FE1F5C8B2C004F2D3F /* Supporting Files */ = {
isa = PBXGroup;
children = (
C93A0FF32292232D0006C88F /* reset.eep */,
09D79CB51FB0DD7F0086ABF6 /* libusb-1.0.0.dylib */,
09D79CBB1FB8A6490086ABF6 /* libusb-0.1.4.dylib */,
09522BBA1F6216BA00AEBC5E /* avrdude.conf */,
09522BB61F61E33B00AEBC5E /* atmega32u4_eeprom_reset.hex */,
09522BB21F61E32700AEBC5E /* mcu-list.txt */,
098AEDFA1F5E45C300CA054D /* dfu-util */,
092964101F5E4186004F2D3F /* avrdude */,
Expand Down Expand Up @@ -205,14 +205,14 @@
buildActionMask = 2147483647;
files = (
09522BB31F61E32700AEBC5E /* mcu-list.txt in Resources */,
C93A0FF42292232E0006C88F /* reset.eep in Resources */,
0929640D1F5E403C004F2D3F /* dfu-programmer in Resources */,
092964021F5C8B2C004F2D3F /* Assets.xcassets in Resources */,
09522BBB1F6216BA00AEBC5E /* avrdude.conf in Resources */,
098AEDFB1F5E45C300CA054D /* dfu-util in Resources */,
0929640F1F5E4068004F2D3F /* teensy_loader_cli in Resources */,
092964111F5E4186004F2D3F /* avrdude in Resources */,
092964051F5C8B2C004F2D3F /* MainMenu.xib in Resources */,
09522BB71F61E33B00AEBC5E /* atmega32u4_eeprom_reset.hex in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
6 changes: 2 additions & 4 deletions osx/qmk_toolbox/Flashing.m
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,8 @@ - (void)resetDFU:(NSString *)mcu {

- (void)eepromResetDFU:(NSString *)mcu {
NSString * result;
NSString * file = [[NSBundle mainBundle] pathForResource:[mcu stringByAppendingString:@"_eeprom_reset"] ofType:@"hex"];
result = [self runProcess:@"dfu-programmer" withArgs:@[mcu, @"erase", @"--force"]];
NSString * file = [[NSBundle mainBundle] pathForResource:@"reset" ofType:@"eep"];
result = [self runProcess:@"dfu-programmer" withArgs:@[mcu, @"flash", @"--eeprom", file]];
[_printer print:@"Device has been erased - please reflash" withType:MessageType_Bootloader];
}

- (void)flashCaterina:(NSString *)mcu withFile:(NSString *)file {
Expand All @@ -110,7 +108,7 @@ - (void)flashCaterina:(NSString *)mcu withFile:(NSString *)file {

- (void)eepromResetCaterina:(NSString *)mcu {
NSString * result;
NSString * file = [mcu stringByAppendingString:@"_eeprom_reset.hex"];
NSString * file = [[NSBundle mainBundle] pathForResource:@"reset" ofType:@"eep"];
result = [self runProcess:@"avrdude" withArgs:@[@"-p", mcu, @"-c", @"avr109", @"-U", [NSString stringWithFormat:@"eeprom:w:%@:i", file], @"-P", caterinaPort, @"-C", @"avrdude.conf"]];
}

Expand Down
12 changes: 3 additions & 9 deletions windows/QMK Toolbox/Flashing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class Flashing : EventArgs
"libusb-1.0.dll",
"libusb0.dll", // x86/libusb0_x86.dll
"mcu-list.txt",
"atmega32u4_eeprom_reset.hex",
"reset.eep",
"dfu-prog-usb-1.2.2.zip",
"bootloadHID.exe",
"mdloadler64.exe",
Expand Down Expand Up @@ -223,17 +223,11 @@ private void FlashDfu(string mcu, string file)

private void ResetDfu(string mcu) => RunProcess("dfu-programmer.exe", $"{mcu} reset");

private void EepromResetDfu(string mcu)
{
var file = mcu + "_eeprom_reset.hex";
RunProcess("dfu-programmer.exe", $"{mcu} erase --force");
RunProcess("dfu-programmer.exe", $"{mcu} flash --eeprom \"{file}\"");
_printer.Print("Device has been erased - please reflash", MessageType.Bootloader);
}
private void EepromResetDfu(string mcu) => RunProcess("dfu-programmer.exe", $"{mcu} flash --eeprom \"reset.eep\"");

private void FlashCaterina(string mcu, string file) => RunProcess("avrdude.exe", $"-p {mcu} -c avr109 -U flash:w:\"{file}\":i -P {CaterinaPort}");

private void EepromResetCaterina(string mcu) => RunProcess("avrdude.exe", $"-p {mcu} -c avr109 -U eeprom:w:\"{mcu}_eeprom_reset.hex\":i -P {CaterinaPort}");
private void EepromResetCaterina(string mcu) => RunProcess("avrdude.exe", $"-p {mcu} -c avr109 -U eeprom:w:\"reset.eep\":i -P {CaterinaPort}");

private void FlashHalfkay(string mcu, string file) => RunProcess("teensy_loader_cli.exe", $"-mmcu={mcu} \"{file}\" -v");

Expand Down
16 changes: 8 additions & 8 deletions windows/QMK Toolbox/QMK Toolbox.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
<DesignTime>True</DesignTime>
</Compile>
<EmbeddedResource Include="avrdude.conf" />
<EmbeddedResource Include="atmega32u4_eeprom_reset.hex" />
<EmbeddedResource Include="reset.eep" />
<EmbeddedResource Include="dfu-prog-usb-1.2.2.zip" />
<EmbeddedResource Include="applet-flash-samd51j18a.bin" />
<None Include="packages.config" />
Expand Down Expand Up @@ -257,11 +257,11 @@
<Error Condition="!Exists('..\packages\Microsoft.Net.Compilers.2.8.2\build\Microsoft.Net.Compilers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Net.Compilers.2.8.2\build\Microsoft.Net.Compilers.props'))" />
</Target>
<Import Project="..\packages\Costura.Fody.1.6.2\build\dotnet\Costura.Fody.targets" Condition="Exists('..\packages\Costura.Fody.1.6.2\build\dotnet\Costura.Fody.targets')" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
9 changes: 0 additions & 9 deletions windows/QMK Toolbox/atmega32u4_eeprom_reset.hex

This file was deleted.

2 changes: 2 additions & 0 deletions windows/QMK Toolbox/reset.eep
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
:0100000000FF
:00000001FF