Skip to content

Commit

Permalink
Improvements in deployment (#210)
Browse files Browse the repository at this point in the history
***PUBLISH_RELEASE***
  • Loading branch information
josesimoes committed Sep 23, 2019
1 parent 826207c commit f77eeef
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 22 deletions.
50 changes: 32 additions & 18 deletions source/USB Test App WPF/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -394,11 +394,6 @@ private async void DeployTestButton_Click(object sender, RoutedEventArgs e)

var totalSize = p1Size + p2Size + p3Size + p4Size;

var largePackets = totalSize / (1024 - 8);

Debug.WriteLine($">>> Sending : {totalSize} bytes.<<<<");
Debug.WriteLine($">>> This is {largePackets} 1k packets plus bytes.<<<<");

try
{
//// add mscorlib
Expand All @@ -416,17 +411,27 @@ private async void DeployTestButton_Click(object sender, RoutedEventArgs e)

await Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() =>
{
var debugEngine = (DataContext as MainViewModel).AvailableDevices[DeviceGrid.SelectedIndex].DebugEngine;
var largePackets = totalSize / (debugEngine.WireProtocolPacketSize - 8);
var packetSize = debugEngine.WireProtocolPacketSize == 1024 ? "1k" : $"({ debugEngine.WireProtocolPacketSize / 1024}bytes";
Debug.WriteLine($">>> Sending : {totalSize} bytes.<<<<");
Debug.WriteLine($">>> This is {packetSize} packets plus something bytes.<<<<");
var result = (DataContext as MainViewModel).AvailableDevices[DeviceGrid.SelectedIndex].DebugEngine.DeploymentExecute(assemblies, true);
Debug.WriteLine($">>> Deployment result: {result} <<<<");
if (result)
{
//(DataContext as MainViewModel).AvailableDevices[DeviceGrid.SelectedIndex].DebugEngine.RebootDevice(RebootOptions.ClrOnly);
//(DataContext as MainViewModel).AvailableDevices[DeviceGrid.SelectedIndex].DebugEngine.RebootDevice(RebootOptions.ClrOnly);
//Task.Delay(1000).Wait();
//Task.Delay(1000).Wait();
(DataContext as MainViewModel).AvailableDevices[DeviceGrid.SelectedIndex].GetDeviceInfo(true);
(DataContext as MainViewModel).AvailableDevices[DeviceGrid.SelectedIndex].GetDeviceInfo(true);
}
}));
}
Expand Down Expand Up @@ -1007,15 +1012,24 @@ private async void OemInfoButton_Click(object sender, RoutedEventArgs e)
var oemInfo = device.DebugEngine.GetMonitorOemInfo();
Debug.WriteLine("");
Debug.WriteLine("");
Debug.WriteLine($"OEM info: {oemInfo.m_releaseInfo.Info}");
Debug.WriteLine("");
Debug.WriteLine($"Platform: {oemInfo.m_releaseInfo.PlatformName}");
Debug.WriteLine("");
Debug.WriteLine($"Target: {oemInfo.m_releaseInfo.TargetName}");
Debug.WriteLine("");
Debug.WriteLine("");
if (oemInfo != null)
{
Debug.WriteLine("");
Debug.WriteLine("");
Debug.WriteLine($"OEM info: {oemInfo.m_releaseInfo.Info}");
Debug.WriteLine("");
Debug.WriteLine($"Platform: {oemInfo.m_releaseInfo.PlatformName}");
Debug.WriteLine("");
Debug.WriteLine($"Target: {oemInfo.m_releaseInfo.TargetName}");
Debug.WriteLine("");
Debug.WriteLine("");
}
else
{
Debug.WriteLine("");
Debug.WriteLine("no OEM info available");
Debug.WriteLine("");
}
}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,19 @@ private void StopDeviceWatchersInternal()
|| (deviceWatcher.Status == DeviceWatcherStatus.EnumerationCompleted))
{
deviceWatcher.Stop();

// need to wait for the watcher to be stopped before proceeding to the next
// 3 attempts
for(int i = 0; i < 3; i++)
{
if( deviceWatcher.Status == DeviceWatcherStatus.Stopped || deviceWatcher.Status == DeviceWatcherStatus.Aborted)
{
// this is OK now
break;
}

Thread.Sleep(300 * i);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2749,7 +2749,7 @@ private bool DeploymentExecuteIncremental(List<byte[]> assemblies, IProgress<str

progress?.Report(errorMessage);

throw new Exception(errorMessage);
return false;
}

while (assemblies.Count > 0)
Expand Down Expand Up @@ -2807,7 +2807,7 @@ private bool DeploymentExecuteIncremental(List<byte[]> assemblies, IProgress<str

progress?.Report(errorMessage);

throw new Exception(errorMessage);
return false;
}
}

Expand All @@ -2819,7 +2819,7 @@ private bool DeploymentExecuteIncremental(List<byte[]> assemblies, IProgress<str
{
(uint ErrorCode, bool Success) memoryOperationResult;

memoryOperationResult = EraseMemory((uint)block.StartAddress, 1);
memoryOperationResult = EraseMemory((uint)block.StartAddress, (uint)block.Size);
if (!memoryOperationResult.Success)
{
progress?.Report(($"Error erasing device memory @ 0x{block.StartAddress.ToString("X8")}. Error code: {memoryOperationResult.ErrorCode}."));
Expand Down Expand Up @@ -2851,7 +2851,7 @@ private bool DeploymentExecuteIncremental(List<byte[]> assemblies, IProgress<str
// invalid flash map
progress?.Report("Error retrieving device flash map.");

throw new Exception("Error retrieving device flash map.");
return false;
}

private bool DeploymentExecuteFull(List<byte[]> assemblies, IProgress<string> progress)
Expand Down

0 comments on commit f77eeef

Please sign in to comment.