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

Update boot options #255

Merged
merged 1 commit into from
Nov 12, 2020
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
17 changes: 9 additions & 8 deletions USB Test App WPF/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
xmlns:local="clr-namespace:Serial_Test_App_WPF"
xmlns:ViewModel="clr-namespace:Serial_Test_App_WPF.ViewModel" x:Class="Serial_Test_App_WPF.MainWindow"
mc:Ignorable="d"
Title="MainWindow" Height="374" Width="525">
Title="MainWindow" Height="374" Width="570.729">
<Window.Resources>
<DataTemplate x:Key="NanoDevicesItemTemplate">
<TextBlock Text="{Binding Path=Description}"/>
Expand Down Expand Up @@ -38,17 +38,18 @@
<Button Content="Pause Execution" HorizontalAlignment="Left" Margin="250,235,0,0" VerticalAlignment="Top" Width="98" Click="PauseExecutionButton_Click" />
<Button Content="Resume Execution" HorizontalAlignment="Left" Margin="250,275,0,0" VerticalAlignment="Top" Width="98" Click="ResumeExecutionButton_Click" />

<Button Content="Reboot CLR" HorizontalAlignment="Left" Margin="378,77,0,0" VerticalAlignment="Top" Width="98" Click="RebootDeviceButton_Click"/>
<Button Content="Soft Reboot" HorizontalAlignment="Left" Margin="378,102,0,0" VerticalAlignment="Top" Width="98" Click="SoftRebootDeviceButton_Click"/>
<Button Content="Reboot + Debug" HorizontalAlignment="Left" Margin="378,129,0,0" VerticalAlignment="Top" Width="98" Click="RebootAndDebugDeviceButton_Click"/>
<Button Content="Stop Processing" HorizontalAlignment="Left" Margin="378,195,0,0" VerticalAlignment="Top" Width="98" Click="StopProcessingButton_Click"/>
<Button Content="Erase Deployment" HorizontalAlignment="Left" Margin="378,235,0,0" VerticalAlignment="Top" Width="98" Click="EraseDeploymentButton_Click" />
<Button Content="Reboot CLR" HorizontalAlignment="Left" Margin="378,77,0,0" VerticalAlignment="Top" Width="121" Click="RebootDeviceButton_Click"/>
<Button Content="Soft Reboot" HorizontalAlignment="Left" Margin="378,102,0,0" VerticalAlignment="Top" Width="121" Click="SoftRebootDeviceButton_Click"/>
<Button Content="Reboot to bootloader" HorizontalAlignment="Left" Margin="378,129,0,0" VerticalAlignment="Top" Width="121" Click="RebootToBootloaderButton_Click"/>
<Button Content="Stop Processing" HorizontalAlignment="Left" Margin="378,195,0,0" VerticalAlignment="Top" Width="121" Click="StopProcessingButton_Click"/>
<Button Content="Erase Deployment" HorizontalAlignment="Left" Margin="378,235,0,0" VerticalAlignment="Top" Width="121" Click="EraseDeploymentButton_Click" />
<Button Content="Is Init State" HorizontalAlignment="Left" Margin="162,195,0,0" VerticalAlignment="Top" Width="75" Click="IsInitStateButton_Click" />
<Button Content="Get Device Config" HorizontalAlignment="Left" Margin="378,275,0,0" VerticalAlignment="Top" Width="98" Click="GetDeviceConfigButton_Click" />
<Button Content="Set Device Config" HorizontalAlignment="Left" Margin="378,313,0,0" VerticalAlignment="Top" Width="98" Click="SetDeviceConfigButton_Click" />
<Button Content="Get Device Config" HorizontalAlignment="Left" Margin="378,275,0,0" VerticalAlignment="Top" Width="121" Click="GetDeviceConfigButton_Click" />
<Button Content="Set Device Config" HorizontalAlignment="Left" Margin="378,313,0,0" VerticalAlignment="Top" Width="121" Click="SetDeviceConfigButton_Click" />
<Button Content="ReScan devices" HorizontalAlignment="Left" Margin="250,157,0,0" VerticalAlignment="Top" Width="98" Click="ReScanDevices_Click" />
<Button Content="Read Test" HorizontalAlignment="Left" Margin="162,313,0,0" VerticalAlignment="Top" Width="75" Click="ReadTestButton_Click" />
<Button Content="OEM Info" HorizontalAlignment="Left" Margin="39,313,0,0" VerticalAlignment="Top" Width="110" Click="OemInfoButton_Click" />
<Button Content="Reboot to nanoBooter" HorizontalAlignment="Left" Margin="378,157,0,0" VerticalAlignment="Top" Width="121" Click="RebootToNanoBooterButton_Click"/>


</Grid>
Expand Down
35 changes: 33 additions & 2 deletions USB Test App WPF/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ private async void SoftRebootDeviceButton_Click(object sender, RoutedEventArgs e
(sender as Button).IsEnabled = true;
}

private async void RebootAndDebugDeviceButton_Click(object sender, RoutedEventArgs e)
private async void RebootToBootloaderButton_Click(object sender, RoutedEventArgs e)
{
// disable button
(sender as Button).IsEnabled = false;
Expand All @@ -722,7 +722,7 @@ private async void RebootAndDebugDeviceButton_Click(object sender, RoutedEventAr
// enable button
(sender as Button).IsEnabled = true;

(DataContext as MainViewModel).AvailableDevices[DeviceGrid.SelectedIndex].DebugEngine.RebootDevice(RebootOptions.ClrOnly | RebootOptions.WaitForDebugger);
(DataContext as MainViewModel).AvailableDevices[DeviceGrid.SelectedIndex].DebugEngine.RebootDevice(RebootOptions.EnterProprietaryBooter);

Debug.WriteLine("");
Debug.WriteLine("");
Expand Down Expand Up @@ -1136,5 +1136,36 @@ private async void OemInfoButton_Click(object sender, RoutedEventArgs e)
(sender as Button).IsEnabled = true;

}

private async void RebootToNanoBooterButton_Click(object sender, RoutedEventArgs e)
{
// disable button
(sender as Button).IsEnabled = false;

try
{
await Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() =>
{
// enable button
(sender as Button).IsEnabled = true;

(DataContext as MainViewModel).AvailableDevices[DeviceGrid.SelectedIndex].DebugEngine.RebootDevice(RebootOptions.EnterNanoBooter);

Debug.WriteLine("");
Debug.WriteLine("");
Debug.WriteLine($"Reboot & launch nanoBooter");
Debug.WriteLine("");
Debug.WriteLine("");

}));
}
catch
{

}

// enable button

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public async Task<bool> ConnectToNanoBooterAsync(CancellationToken cancellationT
{
if (DebugEngine.ConnectionSource == ConnectionSource.nanoBooter) return true;

DebugEngine.RebootDevice(RebootOptions.EnterBootloader);
DebugEngine.RebootDevice(RebootOptions.EnterNanoBooter);

/////////////////////////////////////////
// FIXME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1480,7 +1480,7 @@ public void RebootDevice(RebootOptions options = RebootOptions.NormalReboot)
IncomingMessage reply = PerformSyncRequest(Commands.c_Monitor_Reboot, Flags.c_NoCaching, cmd, 500);

// if reboot options ends on a hard reboot, force connection state to disconnected
if (((RebootOptions)cmd.flags == RebootOptions.EnterBootloader) ||
if (((RebootOptions)cmd.flags == RebootOptions.EnterNanoBooter) ||
((RebootOptions)cmd.flags == RebootOptions.NormalReboot))
{
IsConnected = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ namespace nanoFramework.Tools.Debugger
/// <summary>
/// Reboot options for nanoFramework device.
/// </summary>
[System.Flags]
public enum RebootOptions
{
/// <summary>
Expand All @@ -20,7 +19,7 @@ public enum RebootOptions
/// <summary>
/// Reboot and enter nanoBooter.
/// </summary>
EnterBootloader = 1,
EnterNanoBooter = 1,

/// <summary>
/// Reboot CLR only.
Expand All @@ -30,6 +29,11 @@ public enum RebootOptions
/// <summary>
/// Wait for debugger.
/// </summary>
WaitForDebugger = 4
WaitForDebugger = 4,

/// <summary>
/// Reboot and enter proprietary bootloader.
/// </summary>
EnterProprietaryBooter = 5,
};
}
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
"version": "1.19.0-preview.{height}",
"version": "1.20.0-preview.{height}",
"assemblyVersion": {
"precision": "revision"
},
Expand Down