File tree Expand file tree Collapse file tree 6 files changed +34
-18
lines changed
nanoFramework.Runtime.Native Expand file tree Collapse file tree 6 files changed +34
-18
lines changed Original file line number Diff line number Diff line change @@ -294,19 +294,25 @@ HRESULT CLR_RT_ExecutionEngine::StartHardware()
294294 NANOCLR_NOCLEANUP ();
295295}
296296
297- void CLR_RT_ExecutionEngine::Reboot (bool fHard )
297+ void CLR_RT_ExecutionEngine::Reboot (uint16_t rebootOptions )
298298{
299299 NATIVE_PROFILE_CLR_CORE ();
300300
301- if (fHard )
301+ if (CLR_DBG_Commands::Monitor_Reboot::c_EnterNanoBooter ==
302+ (rebootOptions & CLR_DBG_Commands::Monitor_Reboot::c_EnterNanoBooter))
302303 {
303- ::CPU_Reset ( );
304+ RequestToLaunchNanoBooter ( 0 );
304305 }
305- else
306+ else if (
307+ CLR_DBG_Commands::Monitor_Reboot::c_EnterProprietaryBooter ==
308+ (rebootOptions & CLR_DBG_Commands::Monitor_Reboot::c_EnterProprietaryBooter))
306309 {
307- CLR_EE_REBOOT_CLR;
308- CLR_EE_DBG_SET (RebootPending);
310+ RequestToLaunchProprietaryBootloader ();
309311 }
312+
313+ // apply reboot options and set reboot pending flag
314+ g_CLR_RT_ExecutionEngine.m_iReboot_Options = rebootOptions;
315+ CLR_EE_DBG_SET (RebootPending);
310316}
311317
312318CLR_INT64 CLR_RT_ExecutionEngine::GetUptime ()
Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ struct CLR_DBG_Commands
5252
5353 // ///////////////////////////////////////////////////////////////////////////////////////////////////////
5454 // !!! KEEP IN SYNC WITH nanoFramework.Tools.Debugger.WireProtocol.RebootOptions (in managed code) !!! //
55+ // !!! KEEP IN SYNC WITH nanoFramework.Runtime.Native.WireProtocol.RebootOption (in managed code) !!! //
5556 // CONSTANTS VALUES NEED TO BE 'FLAG' TYPE //
5657 // ///////////////////////////////////////////////////////////////////////////////////////////////////////
5758 struct Monitor_Reboot
Original file line number Diff line number Diff line change @@ -3688,7 +3688,7 @@ struct CLR_RT_ExecutionEngine
36883688
36893689 HRESULT StartHardware ();
36903690
3691- static void Reboot (bool fHard );
3691+ static void Reboot (uint16_t rebootOptions );
36923692
36933693 void JoinAllThreadsAndExecuteFinalizer ();
36943694
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ static const CLR_RT_MethodHandler method_lookup[] =
1919 NULL ,
2020 NULL ,
2121 NULL ,
22- Library_nf_rt_native_nanoFramework_Runtime_Native_Power::NativeReboot___STATIC__VOID ,
22+ Library_nf_rt_native_nanoFramework_Runtime_Native_Power::NativeReboot___STATIC__VOID__nanoFrameworkRuntimeNativeRebootOption ,
2323 NULL ,
2424 NULL ,
2525 NULL ,
@@ -42,9 +42,9 @@ static const CLR_RT_MethodHandler method_lookup[] =
4242const CLR_RT_NativeAssemblyData g_CLR_AssemblyNative_nanoFramework_Runtime_Native =
4343{
4444 " nanoFramework.Runtime.Native" ,
45- 0x109F6F22 ,
45+ 0x0EAE898B ,
4646 method_lookup,
47- { 100 , 0 , 9 , 0 }
47+ { 100 , 0 , 10 , 0 }
4848};
4949
5050// clang-format on
Original file line number Diff line number Diff line change 1010#include <nanoCLR_Interop.h>
1111#include <nanoCLR_Runtime.h>
1212
13+ typedef enum __nfpack RebootOption
14+ {
15+ RebootOption_NormalReboot = 0 ,
16+ RebootOption_EnterNanoBooter = 1 ,
17+ RebootOption_ClrOnly = 2 ,
18+ RebootOption_EnterProprietaryBooter = 8 ,
19+ } RebootOption ;
20+
1321typedef enum __nfpack SystemInfo_FloatingPoint
1422{
1523 SystemInfo_FloatingPoint_None = 0 ,
@@ -38,7 +46,7 @@ struct Library_nf_rt_native_nanoFramework_Runtime_Native_Power
3846{
3947 static const int FIELD_STATIC__OnRebootEvent = 0 ;
4048
41- NANOCLR_NATIVE_DECLARE (NativeReboot___STATIC__VOID );
49+ NANOCLR_NATIVE_DECLARE (NativeReboot___STATIC__VOID__nanoFrameworkRuntimeNativeRebootOption );
4250
4351 //--//
4452};
Original file line number Diff line number Diff line change 33// See LICENSE file in the project root for full license information.
44//
55
6-
76#include " nf_rt_native.h"
7+ #include < nanoCLR_Debugging.h>
88
9- HRESULT Library_nf_rt_native_nanoFramework_Runtime_Native_Power::NativeReboot___STATIC__VOID ( CLR_RT_StackFrame& stack )
9+ HRESULT Library_nf_rt_native_nanoFramework_Runtime_Native_Power::
10+ NativeReboot___STATIC__VOID__nanoFrameworkRuntimeNativeRebootOption (CLR_RT_StackFrame &stack)
1011{
11- (void )stack;
12-
1312 NANOCLR_HEADER ();
14- {
15- g_CLR_RT_ExecutionEngine.Reboot (true );
16- }
13+
14+ RebootOption rebootOption = (RebootOption)stack.Arg0 ().NumericByRef ().u4 ;
15+
16+ g_CLR_RT_ExecutionEngine.Reboot (rebootOption);
17+
1718 NANOCLR_NOCLEANUP_NOLABEL ();
1819}
You can’t perform that action at this time.
0 commit comments